*Span Queries for illustration :*
During Analysis : Inject startSentinel and endSentinal  in your indexed
field ..
So after analysis your field will look like ...
   <start> abc def <endl>
Now during query time, you can expand your query clause programmatic create
queries which will look like
     (<start> xyz <end>) OR  ( <start> abc <end> ) OR ....  basically all
unigrams
  (<start> xyz abc <end> ) OR (<start> abc def <end> ) OR ... bigrams
and so on ...

Then for each of your clauses, you will need to generate a SpanQuery ...
Flexible Query parser can help you here .. You will need to plug a custom
query builder there ..

However, as you can see, ngrams  based queries will results into a lot of
clauses  n^2 .. exactly for just one field .. And if you are searching
across multiple fields then it will go to m * n ^ 2..


On 20 July 2014 10:31, Umesh Prasad <umesh.i...@gmail.com> wrote:

> Please ignore my earlier answer .. I had missed that you wanted a match
> spotting .. So that all the indexed terms must be present in the query ...
>
> One way, I can think of is SpanQueries .. But it won't be efficient and
> won't scale to multiple fields ..
>
> My suggestion would be to  keep the mapping of keyword --> <field name,
> count>  mapping in some key value store
> and use it at query time to find field name for  query terms ..
>
>
>
>
>
>
>
>
>
>
>
>
> On 19 July 2014 02:34, prashantc88 <prashant.chau...@searshc.com> wrote:
>
>> Hi,
>>
>> Thanks for the reply. Is there a better way to do it if the scenario is
>> the
>> following:
>>
>> Indexed values: "abc def"
>>
>> Query String:"xy abc def z"
>>
>> So basically the query string has to match all the words present in the
>> indexed data to give a MATCH.
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://lucene.472066.n3.nabble.com/Match-indexed-data-within-query-string-tp4147896p4147958.html
>> Sent from the Solr - User mailing list archive at Nabble.com.
>>
>
>
>
> --
> ---
> Thanks & Regards
> Umesh Prasad
>



-- 
---
Thanks & Regards
Umesh Prasad

Reply via email to