FAQ
Hi.

I have a trouble with SOLR configuration. Just want to implement
configuration that would be operate with index like MySQL query: field_name
LIKE '%foo%' AND field_name LIKE '%bar%'.

So, for example, I have 4 indexed titles:
'Kathy Lee',
'Kathy Norris',
'Kathy Davies',
'Kathy Bird'

and with my query Kathy Norris I receive all these indexes. Quoted query
give no results at all.

latest field definition that I've try (very simple, just for tests):
<fieldType name="text_ngram" class="solr.TextField" indexed="true"
stored="true" multiValued="true" positionIncrementGap="100"
autoGeneratePhraseQueries="false" >
<analyzer type="index">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.NGramFilterFactory" minGramSize="2"
maxGramSize="100"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.PositionFilterFactory" />
</analyzer>
</fieldType>

Also I've try field with ShingleFilterFactory, also ShingleFilterFactory
combined with NGrams. But no results.

Btw. I have default solr configuration for drupal search_api_solr module,
just modified with a new request handler.

Trying different configurations not give expected results.

Thanks for help.



--
View this message in context: http://lucene.472066.n3.nabble.com/search-by-multiple-LIKE-operator-connected-with-AND-operator-tp4012536.html
Sent from the Solr - User mailing list archive at Nabble.com.

Search Discussions

  • Jack Krupansky at Oct 8, 2012 at 3:27 pm
    The PositionFilterFactory is probably preventing phrase queries from
    working. What are you expecting it to do? It basically means query if all
    the quoted terms occur at the same position.

    SQL "like" is comparable to Lucene wildcard, but change the "%" to "*" and
    "_" to "?".

    -- Jack Krupansky

    -----Original Message-----
    From: gremlin
    Sent: Monday, October 08, 2012 10:47 AM
    To: solr-user@lucene.apache.org
    Subject: search by multiple 'LIKE' operator connected with 'AND' operator

    Hi.

    I have a trouble with SOLR configuration. Just want to implement
    configuration that would be operate with index like MySQL query: field_name
    LIKE '%foo%' AND field_name LIKE '%bar%'.

    So, for example, I have 4 indexed titles:
    'Kathy Lee',
    'Kathy Norris',
    'Kathy Davies',
    'Kathy Bird'

    and with my query Kathy Norris I receive all these indexes. Quoted query
    give no results at all.

    latest field definition that I've try (very simple, just for tests):
    <fieldType name="text_ngram" class="solr.TextField" indexed="true"
    stored="true" multiValued="true" positionIncrementGap="100"
    autoGeneratePhraseQueries="false" >
    <analyzer type="index">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.NGramFilterFactory" minGramSize="2"
    maxGramSize="100"/>
    </analyzer>
    <analyzer type="query">
    <tokenizer class="solr.WhitespaceTokenizerFactory"/>
    <filter class="solr.LowerCaseFilterFactory"/>
    <filter class="solr.PositionFilterFactory" />
    </analyzer>
    </fieldType>

    Also I've try field with ShingleFilterFactory, also ShingleFilterFactory
    combined with NGrams. But no results.

    Btw. I have default solr configuration for drupal search_api_solr module,
    just modified with a new request handler.

    Trying different configurations not give expected results.

    Thanks for help.



    --
    View this message in context:
    http://lucene.472066.n3.nabble.com/search-by-multiple-LIKE-operator-connected-with-AND-operator-tp4012536.html
    Sent from the Solr - User mailing list archive at Nabble.com.
  • Gremlin at Oct 8, 2012 at 3:54 pm
    Disabling PositionFilterFactory is totally break multiword search, and I
    could find titles only by single word.

    Default solr.TextField field with WhitespaceTokenizerFactory returns only
    complete words match, enabling NGramFilterFactory for that field doesn't do
    anything for me. If I use field described I coud find by both words, but no
    'both at a time', just 'one of any'.
    TextField field copied by copyField into NGram field also doesn't helps.

    Maybe I miss something from schema configuration?



    --
    View this message in context: http://lucene.472066.n3.nabble.com/search-by-multiple-LIKE-operator-connected-with-AND-operator-tp4012536p4012554.html
    Sent from the Solr - User mailing list archive at Nabble.com.
  • Suman Ghosh at Oct 9, 2012 at 1:32 pm
    I had a similar issue sometime back and was unable to make multi-word ngram
    match to work. As a workaround, for the require field I replaced all space
    characters with underscore during indexing. While searching, I also replace
    spaces with underscore (for that field) before passing it to the search
    server.

    I suspect there is a more elegant solution using proper tokenizer and
    filters, but could not figure that out. This simple hack works for my
    use-case.
    On Mon, Oct 8, 2012 at 11:54 AM, gremlin wrote:

    Disabling PositionFilterFactory is totally break multiword search, and I
    could find titles only by single word.

    Default solr.TextField field with WhitespaceTokenizerFactory returns only
    complete words match, enabling NGramFilterFactory for that field doesn't do
    anything for me. If I use field described I coud find by both words, but no
    'both at a time', just 'one of any'.
    TextField field copied by copyField into NGram field also doesn't helps.

    Maybe I miss something from schema configuration?



    --
    View this message in context:
    http://lucene.472066.n3.nabble.com/search-by-multiple-LIKE-operator-connected-with-AND-operator-tp4012536p4012554.html
    Sent from the Solr - User mailing list archive at Nabble.com.
  • Gremlin at Oct 10, 2012 at 7:46 am
    I'm also unable to config that type of search through schema.xml. As I use
    SOLR in drupal, I've implement that in hook_search_api_solr_query_alter by
    exploding my search string on two (or more) chunks and now search works
    well.

    Strangely that couldn'y do it through SOLR configuration.



    --
    View this message in context: http://lucene.472066.n3.nabble.com/search-by-multiple-LIKE-operator-connected-with-AND-operator-tp4012536p4012861.html
    Sent from the Solr - User mailing list archive at Nabble.com.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupsolr-user @
categorieslucene
postedOct 8, '12 at 3:06p
activeOct 10, '12 at 7:46a
posts5
users3
websitelucene.apache.org...

People

Translate

site design / logo © 2022 Grokbase