You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Venkata Subbarayudu <av...@gmail.com> on 2008/08/25 13:54:16 UTC

How to search

Hi All,
      I am new to this Lucene, and I am using this for indexing and
searching. Is it possible to search substrings using this, for example if a
field holds the value "LuceneIndex" and if a give the query as Index, I want
to get this field also.. is there anyway for this.
 Thanks in Advance,
 Venkata Subbarayudu.
-- 
View this message in context: http://www.nabble.com/How-to-search-tp19142469p19142469.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: How to search

Posted by Anshum <an...@gmail.com>.
Yes, and that is the reason why I said,
*"it would not be advisable to have a *word like query but a word* like
would be doable"*
*word : is a prefix wildcard, which can be done, but its not all that
straight, and still would be highly against what I would advise
word* : is Doable and ok.

Else if you are so bent on wanting that, you may as well write an
intelligent indexing wrapper to meet your needs (which would again require a
lot of time and effort)

--
Anshum

On Mon, Aug 25, 2008 at 5:35 PM, Venkata Subbarayudu
<av...@gmail.com>wrote:

>
> Hi Anshum Gupta,
>    Thanks for your replay, but when I gone through querySyntax-Document for
> Lucene, I read that Lucene does not allow queries like "*findthis" i.e. I
> think it doesnot allow wildcards in the beginning of the query.
> is it?
>
> Thanks,
> Venkata Subbarayudu.
>
> Anshum-2 wrote:
> >
> > Hi ,
> >
> > You could use wildcard queries in that case (In case I got you right).
> > Though because of the way the indexed terms are stored, it would not be
> > advisable to have a *word like query but a word* like would be doable in
> > real world environment.
> >
> > Hope this answers your question.
> > --
> > Anshum Gupta
> > Naukri Labs!
> > http://ai-cafe.blogspot.com
> >
> > On Mon, Aug 25, 2008 at 5:24 PM, Venkata Subbarayudu
> > <av...@gmail.com>wrote:
> >
> >>
> >> Hi All,
> >>      I am new to this Lucene, and I am using this for indexing and
> >> searching. Is it possible to search substrings using this, for example
> if
> >> a
> >> field holds the value "LuceneIndex" and if a give the query as Index, I
> >> want
> >> to get this field also.. is there anyway for this.
> >>  Thanks in Advance,
> >>  Venkata Subbarayudu.
> >> --
> >> View this message in context:
> >> http://www.nabble.com/How-to-search-tp19142469p19142469.html
> >> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>
> >>
> >
> >
> > --
> > --
> > The facts expressed here belong to everybody, the opinions to me.
> > The distinction is yours to draw............
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-search-tp19142469p19142634.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
--
The facts expressed here belong to everybody, the opinions to me.
The distinction is yours to draw............

RE: How to search

Posted by "Jiao, Jason (NSN - CN/Cheng Du)" <ja...@nsn.com>.
The lucene FAQ says:

What wildcard search support is available from Lucene?
Lucene supports wild card queries which allow you to perform searches
such as book*, which will find documents containing terms such as book,
bookstore, booklet, etc. Lucene refers to this type of a query as a
'prefix query'. 

Lucene also supports wild card queries which allow you to place a wild
card in the middle of the query term. For instance, you could make
searches like: mi*pelling. That will match both misspelling, which is
the correct way to spell this word, as well as mispelling, which is a
common spelling mistake. 

Another wild card character that you can use is '?', a question mark.
The ? will match a single character. This allows you to perform queries
such as Bra?il. Such a query will match both Brasil and Brazil. Lucene
refers to this type of a query as a 'wildcard query'. 

Leading wildcards (e.g. *ook) are not supported by the QueryParser by
default. As of Lucene 2.1, they can be enabled by calling
QueryParser.setAllowLeadingWildcard( true ). Note that this can be an
expensive operation: it requires scanning the list of tokens in the
index in its entirety to look for those that match the pattern. 



Br.
Jason Jiao


>-----Original Message-----
>From: ext Daniel Noll [mailto:daniel@nuix.com] 
>Sent: Tuesday, August 26, 2008 10:50 AM
>To: java-user@lucene.apache.org
>Subject: Re: How to search
>
>Venkata Subbarayudu wrote:
>> Hi Anshum Gupta,
>>     Thanks for your replay, but when I gone through 
>> querySyntax-Document for Lucene, I read that Lucene does not allow 
>> queries like "*findthis" i.e. I think it doesnot allow 
>wildcards in the beginning of the query.
>
>It has supported this for some time now, just not by default.
>
>Daniel
>
>--
>Daniel Noll
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: How to search

Posted by Daniel Noll <da...@nuix.com>.
Venkata Subbarayudu wrote:
> Hi Anshum Gupta,
>     Thanks for your replay, but when I gone through querySyntax-Document for
> Lucene, I read that Lucene does not allow queries like "*findthis" i.e. I
> think it doesnot allow wildcards in the beginning of the query.

It has supported this for some time now, just not by default.

Daniel

-- 
Daniel Noll

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: How to search

Posted by Venkata Subbarayudu <av...@gmail.com>.
Hi Anshum Gupta,
    Thanks for your replay, but when I gone through querySyntax-Document for
Lucene, I read that Lucene does not allow queries like "*findthis" i.e. I
think it doesnot allow wildcards in the beginning of the query.
is it?

Thanks,
Venkata Subbarayudu.

Anshum-2 wrote:
> 
> Hi ,
> 
> You could use wildcard queries in that case (In case I got you right).
> Though because of the way the indexed terms are stored, it would not be
> advisable to have a *word like query but a word* like would be doable in
> real world environment.
> 
> Hope this answers your question.
> --
> Anshum Gupta
> Naukri Labs!
> http://ai-cafe.blogspot.com
> 
> On Mon, Aug 25, 2008 at 5:24 PM, Venkata Subbarayudu
> <av...@gmail.com>wrote:
> 
>>
>> Hi All,
>>      I am new to this Lucene, and I am using this for indexing and
>> searching. Is it possible to search substrings using this, for example if
>> a
>> field holds the value "LuceneIndex" and if a give the query as Index, I
>> want
>> to get this field also.. is there anyway for this.
>>  Thanks in Advance,
>>  Venkata Subbarayudu.
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-search-tp19142469p19142469.html
>> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-user-help@lucene.apache.org
>>
>>
> 
> 
> -- 
> --
> The facts expressed here belong to everybody, the opinions to me.
> The distinction is yours to draw............
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-search-tp19142469p19142634.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: How to search

Posted by Anshum <an...@gmail.com>.
Hi ,

You could use wildcard queries in that case (In case I got you right).
Though because of the way the indexed terms are stored, it would not be
advisable to have a *word like query but a word* like would be doable in
real world environment.

Hope this answers your question.
--
Anshum Gupta
Naukri Labs!
http://ai-cafe.blogspot.com

On Mon, Aug 25, 2008 at 5:24 PM, Venkata Subbarayudu
<av...@gmail.com>wrote:

>
> Hi All,
>      I am new to this Lucene, and I am using this for indexing and
> searching. Is it possible to search substrings using this, for example if a
> field holds the value "LuceneIndex" and if a give the query as Index, I
> want
> to get this field also.. is there anyway for this.
>  Thanks in Advance,
>  Venkata Subbarayudu.
> --
> View this message in context:
> http://www.nabble.com/How-to-search-tp19142469p19142469.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
--
The facts expressed here belong to everybody, the opinions to me.
The distinction is yours to draw............

Re: How to search

Posted by Shalin Shekhar Mangar <sh...@gmail.com>.
On Mon, Aug 25, 2008 at 5:37 PM, Karl Wettin <ka...@gmail.com> wrote:

>
> Is this the specific use case, that you want to handle composite words as
> in javaFieldAndClassNames? There is no native support for that in Lucene to
> my knowledge, but it should not be too hard to implement a TokenStream that
> tokenize such composite words in to single tokens. You probably want to keep
> the original token too though.
>
> Another alternative is creating an ngram index.
>
> Finally you might want to look at the org.apache.lucene.analysis.compound
> package in contrib/analyzers.
>
>
Solr has WordDelimiterFilter which splits on case transition (and many
more). It is exposed through WordDelimiterFilterFactory.

http://lucene.apache.org/solr/api/org/apache/solr/analysis/WordDelimiterFilterFactory.html
http://svn.apache.org/viewvc/lucene/solr/trunk/src/java/org/apache/solr/analysis/WordDelimiterFilter.java?revision=684908&view=markup

-- 
Regards,
Shalin Shekhar Mangar.

Re: How to search

Posted by Karl Wettin <ka...@gmail.com>.
25 aug 2008 kl. 13.54 skrev Venkata Subbarayudu:

>
> Hi All,
>      I am new to this Lucene, and I am using this for indexing and
> searching. Is it possible to search substrings using this, for  
> example if a
> field holds the value "LuceneIndex" and if a give the query as  
> Index, I want
> to get this field also.. is there anyway for this.
>

Is this the specific use case, that you want to handle composite words  
as in javaFieldAndClassNames? There is no native support for that in  
Lucene to my knowledge, but it should not be too hard to implement a  
TokenStream that tokenize such composite words in to single tokens.  
You probably want to keep the original token too though.

Another alternative is creating an ngram index.

Finally you might want to look at the  
org.apache.lucene.analysis.compound package in contrib/analyzers.



           karl

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org