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 Robert Stewart <bo...@kasisto.com> on 2015/03/06 15:19:26 UTC

Solr query to match document "templates" - sort of a reverse wildcard match

If I have SOLR document with field value such as:

"a ? c ? e"

And I want a phrase query such as "a b c d e" to match that document.

So:

q:"a b c d e"  --> return doc with "a ? c ? e" as field value for "q" field.

Is this possible, or is there a way it can be done with a plug-in using
lower level Lucene SDK?  Maybe some custom implementation of TermQuery
where value of "?" always matches any term in the query?

Thanks!
Robert Stewart

Re: Solr query to match document "templates" - sort of a reverse wildcard match

Posted by "david.w.smiley@gmail.com" <da...@gmail.com>.
A Lucene MultiPhraseQuery would work, with each phrase position having two
Terms -- the as-seen word in the query and the term ‘?’.  Performance
wouldn’t be so great given that ‘?’ would appear extremely frequently.  A
variation solving the performance is to use CommonGrams but it would add
some complexity to building the query.

~ David Smiley
Freelance Apache Lucene/Solr Search Consultant/Developer
http://www.linkedin.com/in/davidwsmiley

On Fri, Mar 6, 2015 at 9:19 AM, Robert Stewart <bo...@kasisto.com> wrote:

> If I have SOLR document with field value such as:
>
> "a ? c ? e"
>
> And I want a phrase query such as "a b c d e" to match that document.
>
> So:
>
> q:"a b c d e"  --> return doc with "a ? c ? e" as field value for "q"
> field.
>
> Is this possible, or is there a way it can be done with a plug-in using
> lower level Lucene SDK?  Maybe some custom implementation of TermQuery
> where value of "?" always matches any term in the query?
>
> Thanks!
> Robert Stewart
>

Re: Solr query to match document "templates" - sort of a reverse wildcard match

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Are you looking for Luwak? https://github.com/flaxsearch/luwak

Regards,
   Alex.
----
Solr Analyzers, Tokenizers, Filters, URPs and even a newsletter:
http://www.solr-start.com/


On 6 March 2015 at 09:19, Robert Stewart <bo...@kasisto.com> wrote:
> If I have SOLR document with field value such as:
>
> "a ? c ? e"
>
> And I want a phrase query such as "a b c d e" to match that document.
>
> So:
>
> q:"a b c d e"  --> return doc with "a ? c ? e" as field value for "q" field.
>
> Is this possible, or is there a way it can be done with a plug-in using
> lower level Lucene SDK?  Maybe some custom implementation of TermQuery
> where value of "?" always matches any term in the query?
>
> Thanks!
> Robert Stewart

RE: Solr query to match document "templates" - sort of a reverse wildcard match

Posted by "Reitzel, Charles" <Ch...@tiaa-cref.org>.
Have a look at solr.StopFilterFactory.    

https://cwiki.apache.org/confluence/display/solr/Filter+Descriptions#FilterDescriptions-StopFilter

If your place holders (?) are works like and, the, is, to, etc (see lang/stopwords_??.txt), the stop filter is designed to do what you want.   It leaves holes in the parsed text so that word distance is maintained in the output. 

-----Original Message-----
From: Robert Stewart [mailto:bob@kasisto.com] 
Sent: Friday, March 06, 2015 9:19 AM
To: solr-user@lucene.apache.org
Subject: Solr query to match document "templates" - sort of a reverse wildcard match

If I have SOLR document with field value such as:

"a ? c ? e"

And I want a phrase query such as "a b c d e" to match that document.

So:

q:"a b c d e"  --> return doc with "a ? c ? e" as field value for "q" field.

Is this possible, or is there a way it can be done with a plug-in using lower level Lucene SDK?  Maybe some custom implementation of TermQuery where value of "?" always matches any term in the query?

Thanks!
Robert Stewart

*************************************************************************
This e-mail may contain confidential or privileged information.
If you are not the intended recipient, please notify the sender immediately and then delete it.

TIAA-CREF
*************************************************************************