Colin,

The other thing you'll want to keep in mind (and you'll find this out with
debugQuery) is that the query parser is going to take your
ServiceName:(Search Service) and turn it into two queries --
ServiceName:(Search) ServiceName:(Service). That's because the query parser
breaks on whitespace. My bet is you have a lot of entries with a name of "X
Service" and the second part of your query is hitting them. Phrase Field
might be your friend here:

https://wiki.apache.org/solr/ExtendedDisMax#pf_.28Phrase_Fields.29


-Scott

On Mon, Oct 12, 2015 at 4:15 AM, Colin Hunter <greenfi...@gmail.com> wrote:

> Thanks Erick, I'm sure this will be valuable in implementing ngram filter
> factory
>
> On Fri, Oct 9, 2015 at 4:38 PM, Erick Erickson <erickerick...@gmail.com>
> wrote:
>
> > Colin:
> >
> > Adding &debug=all to your query is your friend here, the
> > parsed_query.toString will show you exactly what
> > is searched against.
> >
> > Best,
> > Erick
> >
> > On Fri, Oct 9, 2015 at 2:09 AM, Colin Hunter <greenfi...@gmail.com>
> wrote:
> > > Ah ha...   the copy field...  makes sense.
> > > Thank You.
> > >
> > > On Fri, Oct 9, 2015 at 10:04 AM, Upayavira <u...@odoko.co.uk> wrote:
> > >
> > >>
> > >>
> > >> On Fri, Oct 9, 2015, at 09:54 AM, Colin Hunter wrote:
> > >> > Hi
> > >> >
> > >> > I am working on a complex search utility with an index created via
> > data
> > >> > import from an extensive MySQL database.
> > >> > There are many ways in which the index is searched. One of the
> utility
> > >> > input fields searches only on a Service Name. However, if I target
> the
> > >> > query as q=ServiceName:"Searched service", this only returns an
> exact
> > >> > string match. If q=Searched Service, the query still returns results
> > from
> > >> > all indexed data.
> > >> >
> > >> > Is there a way to construct a query to only return results from one
> > field
> > >> > of a doc ?
> > >> > I have tried setting index=false, stored=true on unwanted fields,
> but
> > >> > these
> > >> > appear to have still been returned in results.
> > >>
> > >> q=ServiceName:(Searched Service)
> > >>
> > >> That'll look in just one field.
> > >>
> > >> Remember changing indexed to false doesn't impact the stuff already in
> > >> your index. And the reason you are likely getting all that stuff is
> > >> because you have a copyField that copies it over into the 'text'
> field.
> > >> If you'll never want to search on some fields, switch them to
> > >> index=false, make sure you aren't doing a copyField on them, and then
> > >> reindex.
> > >>
> > >> Upayavira
> > >>
> > >
> > >
> > >
> > > --
> > > www.gfc.uk.net
> >
>
>
>
> --
> www.gfc.uk.net
>



-- 
Scott Stults | Founder & Solutions Architect | OpenSource Connections, LLC
| 434.409.2780
http://www.opensourceconnections.com

Reply via email to