You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by bbarani <bb...@gmail.com> on 2018/02/19 18:58:41 UTC
Need help with match contains query in SOLR
Hi,
I have a requirement where I want to perform the 'contains' match and would
need your help to define the fieldtype and query for this requirement.
Value stored in SOLR:
<arr name="searchTerms">
<str>transfer responsibility</str>
<str>transfer account</str>
</arr>
Now, I want the above document to be returned for the below keyword when I
search with additional phrases (when it matches the searched keyword
entirely only)
1.) transfer responsibility issues
1.) how to fix transfer responsibility issues
2.) transfer account issues
3.) troubleshoot transfer account
4.)how to do transfer responsibility
etc...
But should not return when searching for
1.) transfer issues
2.) account issues
3.) how to troubleshoot account
4.)how to do transfer
Idea is to return the document only when the search word matches the whole
value stored in SOLR but the actual search word might have additional
keyword compared to the value stored in SOLR.
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: Need help with match contains query in SOLR
Posted by Emir Arnautović <em...@sematext.com>.
Hi,
Is the size of phrases in index arbitrary or only two words? Do you need to apply some standardisations on individual words? Depending on the answers indexing will be different, but the goal is to index phrase as a single token (might need some custom token filter). At search time, you do shingles of required size(s) and search for exact match.
HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> On 2 Mar 2018, at 01:07, bbarani <bb...@gmail.com> wrote:
>
> The problem with pf2 is that it will return the document if it matches
> loosely too and then I need to do a comparison to see whether the match was
> a complete phrase match OR not before actually using the result. It would
> become a 2 step process..
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: Need help with match contains query in SOLR
Posted by bbarani <bb...@gmail.com>.
The problem with pf2 is that it will return the document if it matches
loosely too and then I need to do a comparison to see whether the match was
a complete phrase match OR not before actually using the result. It would
become a 2 step process..
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: Need help with match contains query in SOLR
Posted by Rick Leir <rl...@leirtech.com>.
Hi
Would a pf2 boost suit your needs? You would match loosely on any term, and your results containing bigrams would be at the top.
HTH -- Rick
On March 1, 2018 11:54:19 AM EST, bbarani <bb...@gmail.com> wrote:
>Hi,
>
>I want to do a complete "phrase contain" match.
>
>For ex: Value is stored as below in the multivalued field
><doc>
><id>1</id>
><arr name="searchTerms">
><str>transfer responsibility</str>
><str>transfer account</str>
></arr>
></doc>
>
>*Positive cases: (when it should return this document)*
>searchTerms:how to transfer responsibility
>searchTerms:show me ways to transfer responsibility
>searchTerms:show me ways to transfer account
>searchTerms:what is transfer accoun
>
>
>*Negative cases: (when it should not return this document)*
>searchTerms:how to transfer
>searchTerms:what is responsibility
>searchTerms:what is account
>searchTerms:what is transfer
>searchTerms:what is transfer and responsibility
>searchTerms:what is transfer and account
>searchTerms:what is account with responsibility
>
>
>
>--
>Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
--
Sorry for being brief. Alternate email is rickleir at yahoo dot com
Re: Need help with match contains query in SOLR
Posted by bbarani <bb...@gmail.com>.
Hi,
I want to do a complete "phrase contain" match.
For ex: Value is stored as below in the multivalued field
<doc>
<id>1</id>
<arr name="searchTerms">
<str>transfer responsibility</str>
<str>transfer account</str>
</arr>
</doc>
*Positive cases: (when it should return this document)*
searchTerms:how to transfer responsibility
searchTerms:show me ways to transfer responsibility
searchTerms:show me ways to transfer account
searchTerms:what is transfer accoun
*Negative cases: (when it should not return this document)*
searchTerms:how to transfer
searchTerms:what is responsibility
searchTerms:what is account
searchTerms:what is transfer
searchTerms:what is transfer and responsibility
searchTerms:what is transfer and account
searchTerms:what is account with responsibility
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html
Re: Need help with match contains query in SOLR
Posted by Alessandro Benedetti <a....@sease.io>.
It was not clear at the beginning, but If I understood correctly you could :
*Index Time analysis*
Use whatever charFilter you need, the keyword tokenizer[1] and then token
filters you like ( such as lowercase filter, synonyms ect)
*Query Time Analysis*
You can use a tokenizer you like ( that tokenizes so not keywordTokenizer),
the Shingle Token filter[2] and
whatever additional filter you need.
This should do the trick.
Cheers
[1]
https://lucene.apache.org/solr/guide/6_6/tokenizers.html#Tokenizers-KeywordTokenizer
[2]
https://lucene.apache.org/solr/guide/6_6/filter-descriptions.html#FilterDescriptions-ShingleFilter
-----
---------------
Alessandro Benedetti
Search Consultant, R&D Software Engineer, Director
Sease Ltd. - www.sease.io
--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html