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 Amit Sela <am...@infolinks.com> on 2013/06/27 09:33:34 UTC

Solr admin search with wildcard

I'm looking to search (in the solr admin search screen) a certain field
for:

*youtube*

I know that leading wildcards takes a lot of resources but I'm not worried
with that

My only question is about the syntax, would this work:

field:"*youtube*" ?

Thanks,

I'm using Solr 3.6.2

Re: Solr admin search with wildcard

Posted by Erick Erickson <er...@gmail.com>.
This is a no-op, or rather I'm not sure what it does:

<copyField source="url" dest="url"/>

This is the key:
<copyField source="iframe" dest="text"/>

But be aware that if you copy anything
else into the "text" field you'll be searching
there too.

Now you can search the "text" field. Assuming
this is from the example, the text field uses the
"text_general" fieldType, which is defined to
use the StandardTokenizerFactory to break up
the incoming stream. Take a look at the javadocs
and/or
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.StandardTokenizerFactory

The admin/analysis page will show you exactly what each
step in an analyzer chain does to the input, you _really_
want to get familiar with that....

One final note, depending on your use-case,
you may not need any copyfield at all, just
use the "text_general" type for your iframe
field.... If you choose this, be sure to delete
your index and re-index from scratch...


Best
Erick




On Thu, Jun 27, 2013 at 9:41 AM, Amit Sela <am...@infolinks.com> wrote:

> Forgive my ignorance but I want to  be sure, do I add <copyField
> source="iframe" dest="text"/> to solrindex-mapping.xml?
> so that my solrindex-mapping.xml looks like this:
> <fields>
>                 <field dest="content" source="content"/>
>                 <field dest="title" source="title"/>
>                 <field dest="iframe" source="iframe"/>
>                 <field dest="host" source="host"/>
>                 <field dest="segment" source="segment"/>
>                 <field dest="boost" source="boost"/>
>                 <field dest="digest" source="digest"/>
>                 <field dest="tstamp" source="tstamp"/>
>                 <field dest="id" source="url"/>
>                 <copyField source="url" dest="url"/>
>                 *<copyField source="iframe" dest="text"/> *
>         </fields>
>         <uniqueKey>url</uniqueKey>
>
> And what do you mean by standard tokenization ?
>
> Thanks!
>
>
> On Thu, Jun 27, 2013 at 3:43 PM, Jack Krupansky <jack@basetechnology.com
> >wrote:
>
> > Just <copyField> from the string field to a "text" field and use standard
> > tokenization, then you can search the text field for "youtube" or even
> > "something" that is a component of the URL path. No wildcard required.
> >
> >
> > -- Jack Krupansky
> >
> > -----Original Message----- From: Amit Sela
> > Sent: Thursday, June 27, 2013 8:37 AM
> > To: solr-user@lucene.apache.org
> > Subject: Re: Solr admin search with wildcard
> >
> >
> > The stored and indexed string is actually a url like "
> > http://www.youtube.com/**somethingsomething<
> http://www.youtube.com/somethingsomething>
> > ".
> > It looks like removing the quotes does the job: iframe:*youtube* or am I
> > wrong ? For now, performance is not an issue, but accuracy is and I would
> > like to know for example how many URLS have iframe source leading to
> > YouTube for example. So query like: iframe:*youtube* with max rows 10 or
> > something will return in the response numFound field the total number of
> > pages that have a tag ifarme with a source matching *youtube, No ?
> >
> >
> > On Thu, Jun 27, 2013 at 3:24 PM, Jack Krupansky <jack@basetechnology.com
> >*
> > *wrote:
> >
> >  No, you cannot use wildcards within a quoted term.
> >>
> >> Tell us a little more about what your strings look like. You might want
> to
> >> consider tokenizing or using ngrams to avoid the need for wildcards.
> >>
> >> -- Jack Krupansky
> >>
> >> -----Original Message----- From: Amit Sela
> >> Sent: Thursday, June 27, 2013 3:33 AM
> >> To: solr-user@lucene.apache.org
> >> Subject: Solr admin search with wildcard
> >>
> >>
> >> I'm looking to search (in the solr admin search screen) a certain field
> >> for:
> >>
> >> *youtube*
> >>
> >> I know that leading wildcards takes a lot of resources but I'm not
> worried
> >> with that
> >>
> >> My only question is about the syntax, would this work:
> >>
> >> field:"*youtube*" ?
> >>
> >> Thanks,
> >>
> >> I'm using Solr 3.6.2
> >>
> >>
> >
>

Re: Solr admin search with wildcard

Posted by Amit Sela <am...@infolinks.com>.
Forgive my ignorance but I want to  be sure, do I add <copyField
source="iframe" dest="text"/> to solrindex-mapping.xml?
so that my solrindex-mapping.xml looks like this:
<fields>
                <field dest="content" source="content"/>
                <field dest="title" source="title"/>
                <field dest="iframe" source="iframe"/>
                <field dest="host" source="host"/>
                <field dest="segment" source="segment"/>
                <field dest="boost" source="boost"/>
                <field dest="digest" source="digest"/>
                <field dest="tstamp" source="tstamp"/>
                <field dest="id" source="url"/>
                <copyField source="url" dest="url"/>
                *<copyField source="iframe" dest="text"/> *
        </fields>
        <uniqueKey>url</uniqueKey>

And what do you mean by standard tokenization ?

Thanks!


On Thu, Jun 27, 2013 at 3:43 PM, Jack Krupansky <ja...@basetechnology.com>wrote:

> Just <copyField> from the string field to a "text" field and use standard
> tokenization, then you can search the text field for "youtube" or even
> "something" that is a component of the URL path. No wildcard required.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: Amit Sela
> Sent: Thursday, June 27, 2013 8:37 AM
> To: solr-user@lucene.apache.org
> Subject: Re: Solr admin search with wildcard
>
>
> The stored and indexed string is actually a url like "
> http://www.youtube.com/**somethingsomething<http://www.youtube.com/somethingsomething>
> ".
> It looks like removing the quotes does the job: iframe:*youtube* or am I
> wrong ? For now, performance is not an issue, but accuracy is and I would
> like to know for example how many URLS have iframe source leading to
> YouTube for example. So query like: iframe:*youtube* with max rows 10 or
> something will return in the response numFound field the total number of
> pages that have a tag ifarme with a source matching *youtube, No ?
>
>
> On Thu, Jun 27, 2013 at 3:24 PM, Jack Krupansky <ja...@basetechnology.com>*
> *wrote:
>
>  No, you cannot use wildcards within a quoted term.
>>
>> Tell us a little more about what your strings look like. You might want to
>> consider tokenizing or using ngrams to avoid the need for wildcards.
>>
>> -- Jack Krupansky
>>
>> -----Original Message----- From: Amit Sela
>> Sent: Thursday, June 27, 2013 3:33 AM
>> To: solr-user@lucene.apache.org
>> Subject: Solr admin search with wildcard
>>
>>
>> I'm looking to search (in the solr admin search screen) a certain field
>> for:
>>
>> *youtube*
>>
>> I know that leading wildcards takes a lot of resources but I'm not worried
>> with that
>>
>> My only question is about the syntax, would this work:
>>
>> field:"*youtube*" ?
>>
>> Thanks,
>>
>> I'm using Solr 3.6.2
>>
>>
>

Re: Solr admin search with wildcard

Posted by Jack Krupansky <ja...@basetechnology.com>.
Just <copyField> from the string field to a "text" field and use standard 
tokenization, then you can search the text field for "youtube" or even 
"something" that is a component of the URL path. No wildcard required.

-- Jack Krupansky

-----Original Message----- 
From: Amit Sela
Sent: Thursday, June 27, 2013 8:37 AM
To: solr-user@lucene.apache.org
Subject: Re: Solr admin search with wildcard

The stored and indexed string is actually a url like "
http://www.youtube.com/somethingsomething".
It looks like removing the quotes does the job: iframe:*youtube* or am I
wrong ? For now, performance is not an issue, but accuracy is and I would
like to know for example how many URLS have iframe source leading to
YouTube for example. So query like: iframe:*youtube* with max rows 10 or
something will return in the response numFound field the total number of
pages that have a tag ifarme with a source matching *youtube, No ?


On Thu, Jun 27, 2013 at 3:24 PM, Jack Krupansky 
<ja...@basetechnology.com>wrote:

> No, you cannot use wildcards within a quoted term.
>
> Tell us a little more about what your strings look like. You might want to
> consider tokenizing or using ngrams to avoid the need for wildcards.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Amit Sela
> Sent: Thursday, June 27, 2013 3:33 AM
> To: solr-user@lucene.apache.org
> Subject: Solr admin search with wildcard
>
>
> I'm looking to search (in the solr admin search screen) a certain field
> for:
>
> *youtube*
>
> I know that leading wildcards takes a lot of resources but I'm not worried
> with that
>
> My only question is about the syntax, would this work:
>
> field:"*youtube*" ?
>
> Thanks,
>
> I'm using Solr 3.6.2
> 


Re: Solr admin search with wildcard

Posted by Amit Sela <am...@infolinks.com>.
The stored and indexed string is actually a url like "
http://www.youtube.com/somethingsomething".
It looks like removing the quotes does the job: iframe:*youtube* or am I
wrong ? For now, performance is not an issue, but accuracy is and I would
like to know for example how many URLS have iframe source leading to
YouTube for example. So query like: iframe:*youtube* with max rows 10 or
something will return in the response numFound field the total number of
pages that have a tag ifarme with a source matching *youtube, No ?


On Thu, Jun 27, 2013 at 3:24 PM, Jack Krupansky <ja...@basetechnology.com>wrote:

> No, you cannot use wildcards within a quoted term.
>
> Tell us a little more about what your strings look like. You might want to
> consider tokenizing or using ngrams to avoid the need for wildcards.
>
> -- Jack Krupansky
>
> -----Original Message----- From: Amit Sela
> Sent: Thursday, June 27, 2013 3:33 AM
> To: solr-user@lucene.apache.org
> Subject: Solr admin search with wildcard
>
>
> I'm looking to search (in the solr admin search screen) a certain field
> for:
>
> *youtube*
>
> I know that leading wildcards takes a lot of resources but I'm not worried
> with that
>
> My only question is about the syntax, would this work:
>
> field:"*youtube*" ?
>
> Thanks,
>
> I'm using Solr 3.6.2
>

Re: Solr admin search with wildcard

Posted by Jack Krupansky <ja...@basetechnology.com>.
No, you cannot use wildcards within a quoted term.

Tell us a little more about what your strings look like. You might want to 
consider tokenizing or using ngrams to avoid the need for wildcards.

-- Jack Krupansky

-----Original Message----- 
From: Amit Sela
Sent: Thursday, June 27, 2013 3:33 AM
To: solr-user@lucene.apache.org
Subject: Solr admin search with wildcard

I'm looking to search (in the solr admin search screen) a certain field
for:

*youtube*

I know that leading wildcards takes a lot of resources but I'm not worried
with that

My only question is about the syntax, would this work:

field:"*youtube*" ?

Thanks,

I'm using Solr 3.6.2