开发者

Sphinx sentence like query

my task is to find a similar sentence in database collection.

Could you advise me which query type to use?

Sample: Search: Welcome to the first 开发者_开发技巧sample code.

And let say the following sentences are fine for my query:

Dbase:

...

Welcome in first movie ...

This is first sample code ...

Welcome! ...

Thanks


If I got it correctly, each sentence in the DB, which includes one or more words from the search query, is fine.

In this case, you have to use the SPH_MATCH_ANY mode or SPH_MATCH_EXTENDED2 with | (OR) operator.

Matching modes...

Extended query syntax...

If you want to exclude such words as "to", "the" and other short words, you have several options:

1) If you are sure that each word which is less than 4 letters should be excluded, add the following line to your sphinx.conf file:

min_word_len = 4

Read more...

2) if you want to exclude specific words, use the stopwords file(s).

Add the following lines to sphinx.conf:

#path to txt file with words to be excluded (space separated)
stopwords = /usr/local/sphinx/configuration/stopwords.txt   

Read more...

And the last thing you should know is that I just provided very basic things which are clearly explained in the documentation and my examples are also taken from there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜