That's correct behavior for the query parser you are with (default/lucene it seems): https://solr.apache.org/guide/8_8/the-standard-query-parser.html.
You could explore other query parsers, e.g. field: https://solr.apache.org/guide/8_8/other-parsers.html#field-query-parser , possibly combined with parameter substitution. Regards, Alex. On Tue, 23 Mar 2021 at 15:58, Subhajit Das <subhajitdas...@live.com> wrote: > > Hi Alessandro, > > Thanks for the suggestion. > > The issue is that, without the double quotes, query like “ field: ola hello > hi ” parses into “ field: ola (text:hello text:hi) ”. Which means that it is > breaking in space and considering only first one. And all parts are or to > each other. Wrapping in double quotes, solves the issue. > > Is this the default behaviour? > > Thanks, > Subhajit > > From: Alessandro Benedetti<mailto:a.benede...@sease.io> > Sent: 24 March 2021 12:06 AM > To: users@solr.apache.org<mailto:users@solr.apache.org> > Cc: solr-u...@lucene.apache.org<mailto:solr-u...@lucene.apache.org> > Subject: Re: StrField not matching content "equals" way > > Hi Subhajit, > that's weird, if you use StrField no text analysis happens. > This means in the inverted index a single token is built for the text "abc > xyz". > So neither the query field:xyz neither the phrase query field:"xyz" is > supposed to return you such document. > > I would recommend running the query with debug=query enabled in the request > parameters ( > https://solr.apache.org/guide/6_6/common-query-parameters.html#CommonQueryParameters-ThedebugParameter > ) > In this way, we'll see how the query is parsed and the real fields involved > in the query. > > Cheers > -------------------------- > Alessandro Benedetti > Apache Lucene/Solr Committer > Director, R&D Software Engineer, Search Consultant > www.sease.io<http://www.sease.io> > > > On Tue, 23 Mar 2021 at 17:39, Subhajit Das <subhajitdas...@live.com> wrote: > > > > > Hi, > > > > I have a field with type string (StrField). The data in it is like “abc > > xyz”. But when I search for “xyz”, I am getting one document containing > > “abc xyz”. > > > > Using q and fq is same for this. > > > > When I filter like field=”xyz” it works, but field=xyz dosen’t. > > > > Thanks and Regards, > > Subhajit > > >