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 Jörg Agatz <jo...@googlemail.com> on 2009/07/20 14:09:05 UTC

Wildcards at the Beginning of a Search.

Hallo Solr Users...

I tryed to search with a Wildcard at the beginning from a search.

for example, i will search for "*est" and get "test, vogelnest, fest, ...."
But it dosent work, i alsways get an error...

Now my Big brother GOOGLE tolds me, that it can work but a search with a
Wildcad at the beginning need a long time...

Now i will test ist. but How?

Re: Wildcards at the Beginning of a Search.

Posted by Jay Hill <ja...@gmail.com>.
There is a "text_rev" field type in the example schema.xml file in the
official release of 1.4. It uses the ReversedWildcardFilterFactory to revers
a field. You can do a copyField from the field you want to use for leading
wildcard searches to a field using the text_rev field, and then do a regular
trailing wildcard search on the reversed field.

-Jay
http://www.lucidimagination.com


On Thu, Nov 12, 2009 at 4:41 AM, Jörg Agatz <jo...@googlemail.com>wrote:

> is in solr 1.4 maby a way to search with an wildcard at the beginning?
>
> in 1.3 i cant activate it.
>
> KingArtus
>

Re: Wildcards at the Beginning of a Search.

Posted by Jörg Agatz <jo...@googlemail.com>.
is in solr 1.4 maby a way to search with an wildcard at the beginning?

in 1.3 i cant activate it.

KingArtus

RE: Wildcards at the Beginning of a Search.

Posted by Brian Klippel <br...@theport.com>.
Depending on how you are sending docs in for indexing, you could also add an additional field who's value was a string reverse of the primary value.  Then search that field with a trialing wildcard.



-----Original Message-----
From: Jeff Newburn [mailto:jnewburn@zappos.com] 
Sent: Monday, July 20, 2009 10:00 AM
To: solr-user@lucene.apache.org
Subject: Re: Wildcards at the Beginning of a Search.

There is a hacky way to do it if you can pull it off.  You can prepend some
known prefix to the field then strip it off when you get the results back.
An example would be putting Phone: in front of every value in a phone number
field then instead of searching like this *-111-1111 (which won't work) you
would search (Phone: *-111-1111).  Keep in mind this way will work
syntactically but basically changes the index into a file sort so you will
see a performance dip.
-- 
Jeff Newburn
Software Engineer, Zappos.com
jnewburn@zappos.com - 702-943-7562


> From: Erik Hatcher <er...@ehatchersolutions.com>
> Reply-To: <so...@lucene.apache.org>
> Date: Mon, 20 Jul 2009 08:20:15 -0400
> To: <so...@lucene.apache.org>
> Subject: Re: Wildcards at the Beginning of a Search.
> 
> See http://issues.apache.org/jira/browse/SOLR-218 - Solr currently
> does not have leading wildcard support enabled.
> 
> Erik
> 
> On Jul 20, 2009, at 8:09 AM, Jörg Agatz wrote:
> 
>> Hallo Solr Users...
>> 
>> I tryed to search with a Wildcard at the beginning from a search.
>> 
>> for example, i will search for "*est" and get "test, vogelnest,
>> fest, ...."
>> But it dosent work, i alsways get an error...
>> 
>> Now my Big brother GOOGLE tolds me, that it can work but a search
>> with a
>> Wildcad at the beginning need a long time...
>> 
>> Now i will test ist. but How?
> 


Re: Is it possible to query for "everything" ?

Posted by Erik Hatcher <er...@gmail.com>.
[* TO *] on the standard handler is an implicit query of  
default_field_name:[* TO *] which matches only documents that have the  
default field on them.   So [* TO *] and *:* are two very different  
queries, only the latter guaranteed to match all documents.

	Erik


On Sep 14, 2009, at 9:39 PM, Bill Au wrote:

> For the standard query handler, try [* TO *].
> Bill
>
> On Mon, Sep 14, 2009 at 8:46 PM, Jay Hill <ja...@gmail.com>  
> wrote:
>
>> With dismax you can use q.alt when the q param is missing:
>> q.alt=*:*
>> should work.
>>
>> -Jay
>>
>>
>> On Mon, Sep 14, 2009 at 5:38 PM, Jonathan Vanasco <jv...@2xlp.com>
>> wrote:
>>
>>> Thanks Jay & Matt
>>>
>>> I tried *:* on my app, and it didn't work
>>>
>>> I tried it on the solr admin, and it did
>>>
>>> I checked the solr config file, and realized that it works on  
>>> standard,
>> but
>>> not on dismax, queries
>>>
>>> So i have my app checking *:* on a standard qt, and then filtering  
>>> what I
>>> need on other qts!
>>>
>>> I would never have figured this out without you two!
>>>
>>


Re: Is it possible to query for "everything" ?

Posted by Bill Au <bi...@gmail.com>.
For the standard query handler, try [* TO *].
Bill

On Mon, Sep 14, 2009 at 8:46 PM, Jay Hill <ja...@gmail.com> wrote:

> With dismax you can use q.alt when the q param is missing:
> q.alt=*:*
> should work.
>
> -Jay
>
>
> On Mon, Sep 14, 2009 at 5:38 PM, Jonathan Vanasco <jv...@2xlp.com>
> wrote:
>
> > Thanks Jay & Matt
> >
> > I tried *:* on my app, and it didn't work
> >
> > I tried it on the solr admin, and it did
> >
> > I checked the solr config file, and realized that it works on standard,
> but
> > not on dismax, queries
> >
> > So i have my app checking *:* on a standard qt, and then filtering what I
> > need on other qts!
> >
> > I would never have figured this out without you two!
> >
>

Re: Is it possible to query for "everything" ?

Posted by Jay Hill <ja...@gmail.com>.
With dismax you can use q.alt when the q param is missing:
q.alt=*:*
should work.

-Jay


On Mon, Sep 14, 2009 at 5:38 PM, Jonathan Vanasco <jv...@2xlp.com> wrote:

> Thanks Jay & Matt
>
> I tried *:* on my app, and it didn't work
>
> I tried it on the solr admin, and it did
>
> I checked the solr config file, and realized that it works on standard, but
> not on dismax, queries
>
> So i have my app checking *:* on a standard qt, and then filtering what I
> need on other qts!
>
> I would never have figured this out without you two!
>

Re: Is it possible to query for "everything" ?

Posted by Jonathan Vanasco <jv...@2xlp.com>.
Thanks Jay & Matt

I tried *:* on my app, and it didn't work

I tried it on the solr admin, and it did

I checked the solr config file, and realized that it works on  
standard, but not on dismax, queries

So i have my app checking *:* on a standard qt, and then filtering  
what I need on other qts!

I would never have figured this out without you two!

Re: Is it possible to query for "everything" ?

Posted by Matt Weber <ma...@mattweber.org>.
Query for *:*

Thanks,

Matt Weber

On Sep 14, 2009, at 4:18 PM, Jonathan Vanasco wrote:

> I'm using Solr for seach and faceted browsing
>
> Is it possible to have solr search for 'everything' , at least as  
> far as q is concerned ?
>
> The request handlers I've found don't like it if I don't pass in a q  
> parameter


Re: Is it possible to query for "everything" ?

Posted by Jay Hill <ja...@gmail.com>.
Use: ?q=*:*

-Jay
http://www.lucidimagination.com


On Mon, Sep 14, 2009 at 4:18 PM, Jonathan Vanasco <jv...@2xlp.com> wrote:

> I'm using Solr for seach and faceted browsing
>
> Is it possible to have solr search for 'everything' , at least as far as q
> is concerned ?
>
> The request handlers I've found don't like it if I don't pass in a q
> parameter
>

Is it possible to query for "everything" ?

Posted by Jonathan Vanasco <jv...@2xlp.com>.
I'm using Solr for seach and faceted browsing

Is it possible to have solr search for 'everything' , at least as far  
as q is concerned ?

The request handlers I've found don't like it if I don't pass in a q  
parameter

Re: Wildcards at the Beginning of a Search.

Posted by Reza Safari <r....@lukkien.com>.
Add setAllowLeadingWildcard(true); to the constructor of  
org.apache.solr.search.SolrQueryParser.java

Gr, Reza

On Jul 20, 2009, at 4:00 PM, Jeff Newburn wrote:

> There is a hacky way to do it if you can pull it off.  You can  
> prepend some
> known prefix to the field then strip it off when you get the results  
> back.
> An example would be putting Phone: in front of every value in a  
> phone number
> field then instead of searching like this *-111-1111 (which won't  
> work) you
> would search (Phone: *-111-1111).  Keep in mind this way will work
> syntactically but basically changes the index into a file sort so  
> you will
> see a performance dip.
> -- 
> Jeff Newburn
> Software Engineer, Zappos.com
> jnewburn@zappos.com - 702-943-7562
>
>
>> From: Erik Hatcher <er...@ehatchersolutions.com>
>> Reply-To: <so...@lucene.apache.org>
>> Date: Mon, 20 Jul 2009 08:20:15 -0400
>> To: <so...@lucene.apache.org>
>> Subject: Re: Wildcards at the Beginning of a Search.
>>
>> See http://issues.apache.org/jira/browse/SOLR-218 - Solr currently
>> does not have leading wildcard support enabled.
>>
>> Erik
>>
>> On Jul 20, 2009, at 8:09 AM, Jörg Agatz wrote:
>>
>>> Hallo Solr Users...
>>>
>>> I tryed to search with a Wildcard at the beginning from a search.
>>>
>>> for example, i will search for "*est" and get "test, vogelnest,
>>> fest, ...."
>>> But it dosent work, i alsways get an error...
>>>
>>> Now my Big brother GOOGLE tolds me, that it can work but a search
>>> with a
>>> Wildcad at the beginning need a long time...
>>>
>>> Now i will test ist. but How?
>>
>

















Re: Wildcards at the Beginning of a Search.

Posted by Jeff Newburn <jn...@zappos.com>.
There is a hacky way to do it if you can pull it off.  You can prepend some
known prefix to the field then strip it off when you get the results back.
An example would be putting Phone: in front of every value in a phone number
field then instead of searching like this *-111-1111 (which won't work) you
would search (Phone: *-111-1111).  Keep in mind this way will work
syntactically but basically changes the index into a file sort so you will
see a performance dip.
-- 
Jeff Newburn
Software Engineer, Zappos.com
jnewburn@zappos.com - 702-943-7562


> From: Erik Hatcher <er...@ehatchersolutions.com>
> Reply-To: <so...@lucene.apache.org>
> Date: Mon, 20 Jul 2009 08:20:15 -0400
> To: <so...@lucene.apache.org>
> Subject: Re: Wildcards at the Beginning of a Search.
> 
> See http://issues.apache.org/jira/browse/SOLR-218 - Solr currently
> does not have leading wildcard support enabled.
> 
> Erik
> 
> On Jul 20, 2009, at 8:09 AM, Jörg Agatz wrote:
> 
>> Hallo Solr Users...
>> 
>> I tryed to search with a Wildcard at the beginning from a search.
>> 
>> for example, i will search for "*est" and get "test, vogelnest,
>> fest, ...."
>> But it dosent work, i alsways get an error...
>> 
>> Now my Big brother GOOGLE tolds me, that it can work but a search
>> with a
>> Wildcad at the beginning need a long time...
>> 
>> Now i will test ist. but How?
> 


Re: Wildcards at the Beginning of a Search.

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
See http://issues.apache.org/jira/browse/SOLR-218 - Solr currently  
does not have leading wildcard support enabled.

	Erik

On Jul 20, 2009, at 8:09 AM, Jörg Agatz wrote:

> Hallo Solr Users...
>
> I tryed to search with a Wildcard at the beginning from a search.
>
> for example, i will search for "*est" and get "test, vogelnest,  
> fest, ...."
> But it dosent work, i alsways get an error...
>
> Now my Big brother GOOGLE tolds me, that it can work but a search  
> with a
> Wildcad at the beginning need a long time...
>
> Now i will test ist. but How?