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 Mohsen Saboorian <mo...@gmail.com> on 2015/07/30 09:40:05 UTC
How to handle line breaks for quoted queries
How can I recognize line breaks and do not allow matching of a quoted query
in the following example.
I have two documents with just one text field:
1. AAA BBB <line break>
CCC DDD
2. BBB CCC <line break>
DDD AAA
User enters query "BBB CCC". How can I configure tokenizers so that Solr
only returns doc #2?
Thanks,
Mohsen
Re: How to handle line breaks for quoted queries
Posted by Alessandro Benedetti <be...@gmail.com>.
Hi Mohsen,
this is the perfect place for the *positionIncrementGap *attribute for your
field type*.*
<fieldType name="text_general" class="solr.TextField" *positionIncrementGap*
="100">
First of all when phrase or positional searches are necessary you need to
store term positions in your index.
The position increment gap will increment the position when a multi valued
field happens.
At this point you different solutions :
1) you provide multiple values based on line break if this fit for your use
case
2) more likely you take a look to a tokenizer that do the position
increment on its own when a line break is found.
If you use the analysis tool now, what will you get for your tokens and
positions ?
How the line break is indexed ?
You can review positions with the analysis tool !
Cheers
2015-07-30 8:40 GMT+01:00 Mohsen Saboorian <mo...@gmail.com>:
> How can I recognize line breaks and do not allow matching of a quoted query
> in the following example.
>
> I have two documents with just one text field:
> 1. AAA BBB <line break>
> CCC DDD
>
> 2. BBB CCC <line break>
> DDD AAA
>
> User enters query "BBB CCC". How can I configure tokenizers so that Solr
> only returns doc #2?
>
> Thanks,
> Mohsen
>
--
--------------------------
Benedetti Alessandro
Visiting card - http://about.me/alessandro_benedetti
Blog - http://alexbenedetti.blogspot.co.uk
"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"
William Blake - Songs of Experience -1794 England