You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@solr.apache.org by Ritesh Kumar <im...@gmail.com> on 2023/03/17 05:36:53 UTC

Surround Query Parser: Not able to perform a search on integer field type

Hello team,

I have this query

q={!surround}(field1:(10w(term1,term2))) AND field2:1199

The field2  is of type solr.TrieIntField. I do not get any document
against this query. I am certain that the documents exists for the
above query.

q={!surround}(field1:(10w(term1,term2))) works fine but using the
integer field2 does not fetch any result.

I know that I can move the field2 part to fq but is there a way to
make it work with q only without changing the type of field2 to
string?

Thank you.
Ritesh Kumar

Re: Surround Query Parser: Not able to perform a search on integer field type

Posted by Mikhail Khludnev <mk...@apache.org>.
It's not clear, probably you want to move the second part out of
{!surround} logic.
You may try these alternatives:
q=field2:1199 AND {!surround}(field1:(10w(term1,term2)))
q=+field2:1199 +{!surround}(field1:(10w(term1,term2)))
q=+field2:1199 +{!surround v='field1:(10w(term1,term2))'}


On Fri, Mar 17, 2023 at 3:33 PM Ritesh Kumar <im...@gmail.com>
wrote:

> This is what I am getting for this  query
>
> q={!surround maxBasicQueries=4800} (name:(5w(apple,electro))) AND
> (popularity:5)
>
>
> "rawquerystring":"{!surround maxBasicQueries=4800}
> (name:(5w(apple,electro))) AND (popularity:5)",
> "querystring":"{!surround maxBasicQueries=4800}
> (name:(5w(apple,electro))) AND (popularity:5)",
>
>
>  "parsedquery":"+DistanceRewriteQuery(org.apache.lucene.queryparser.surround.query.DistanceRewriteQuery(name,
> 5w(apple, electro),
>
> org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries:
> 4800, queriesMade: 1)))
>
> +SimpleTermRewriteQuery(org.apache.lucene.queryparser.surround.query.SimpleTermRewriteQuery(popularity,
> 5,
> org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries:
> 4800, queriesMade: 1)))",
>
>
> "parsedquery_toString":"+org.apache.lucene.queryparser.surround.query.DistanceRewriteQuery(name,
> 5w(apple, electro),
>
> org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries:
> 4800, queriesMade: 1))
>
> +org.apache.lucene.queryparser.surround.query.SimpleTermRewriteQuery(popularity,
> 5,
> org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries:
> 4800, queriesMade: 1))",
>
> On Fri, Mar 17, 2023 at 5:05 PM Mikhail Khludnev <mk...@apache.org> wrote:
> >
> > Hello Ritesh.
> > Can you check debugQuery output to see how it's parsed?
> >
> > On Fri, Mar 17, 2023 at 8:37 AM Ritesh Kumar <im...@gmail.com>
> > wrote:
> >
> > > Hello team,
> > >
> > > I have this query
> > >
> > > q={!surround}(field1:(10w(term1,term2))) AND field2:1199
> > >
> > > The field2  is of type solr.TrieIntField. I do not get any document
> > > against this query. I am certain that the documents exists for the
> > > above query.
> > >
> > > q={!surround}(field1:(10w(term1,term2))) works fine but using the
> > > integer field2 does not fetch any result.
> > >
> > > I know that I can move the field2 part to fq but is there a way to
> > > make it work with q only without changing the type of field2 to
> > > string?
> > >
> > > Thank you.
> > > Ritesh Kumar
> > >
> >
> >
> > --
> > Sincerely yours
> > Mikhail Khludnev
> > https://t.me/MUST_SEARCH
> > A caveat: Cyrillic!
>


-- 
Sincerely yours
Mikhail Khludnev
https://t.me/MUST_SEARCH
A caveat: Cyrillic!

Re: Surround Query Parser: Not able to perform a search on integer field type

Posted by Ritesh Kumar <im...@gmail.com>.
This is what I am getting for this  query

q={!surround maxBasicQueries=4800} (name:(5w(apple,electro))) AND (popularity:5)


"rawquerystring":"{!surround maxBasicQueries=4800}
(name:(5w(apple,electro))) AND (popularity:5)",
"querystring":"{!surround maxBasicQueries=4800}
(name:(5w(apple,electro))) AND (popularity:5)",

 "parsedquery":"+DistanceRewriteQuery(org.apache.lucene.queryparser.surround.query.DistanceRewriteQuery(name,
5w(apple, electro),
org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries:
4800, queriesMade: 1)))
+SimpleTermRewriteQuery(org.apache.lucene.queryparser.surround.query.SimpleTermRewriteQuery(popularity,
5, org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries:
4800, queriesMade: 1)))",

"parsedquery_toString":"+org.apache.lucene.queryparser.surround.query.DistanceRewriteQuery(name,
5w(apple, electro),
org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries:
4800, queriesMade: 1))
+org.apache.lucene.queryparser.surround.query.SimpleTermRewriteQuery(popularity,
5, org.apache.lucene.queryparser.surround.query.BasicQueryFactory(maxBasicQueries:
4800, queriesMade: 1))",

On Fri, Mar 17, 2023 at 5:05 PM Mikhail Khludnev <mk...@apache.org> wrote:
>
> Hello Ritesh.
> Can you check debugQuery output to see how it's parsed?
>
> On Fri, Mar 17, 2023 at 8:37 AM Ritesh Kumar <im...@gmail.com>
> wrote:
>
> > Hello team,
> >
> > I have this query
> >
> > q={!surround}(field1:(10w(term1,term2))) AND field2:1199
> >
> > The field2  is of type solr.TrieIntField. I do not get any document
> > against this query. I am certain that the documents exists for the
> > above query.
> >
> > q={!surround}(field1:(10w(term1,term2))) works fine but using the
> > integer field2 does not fetch any result.
> >
> > I know that I can move the field2 part to fq but is there a way to
> > make it work with q only without changing the type of field2 to
> > string?
> >
> > Thank you.
> > Ritesh Kumar
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
> https://t.me/MUST_SEARCH
> A caveat: Cyrillic!

Re: Surround Query Parser: Not able to perform a search on integer field type

Posted by Mikhail Khludnev <mk...@apache.org>.
Hello Ritesh.
Can you check debugQuery output to see how it's parsed?

On Fri, Mar 17, 2023 at 8:37 AM Ritesh Kumar <im...@gmail.com>
wrote:

> Hello team,
>
> I have this query
>
> q={!surround}(field1:(10w(term1,term2))) AND field2:1199
>
> The field2  is of type solr.TrieIntField. I do not get any document
> against this query. I am certain that the documents exists for the
> above query.
>
> q={!surround}(field1:(10w(term1,term2))) works fine but using the
> integer field2 does not fetch any result.
>
> I know that I can move the field2 part to fq but is there a way to
> make it work with q only without changing the type of field2 to
> string?
>
> Thank you.
> Ritesh Kumar
>


-- 
Sincerely yours
Mikhail Khludnev
https://t.me/MUST_SEARCH
A caveat: Cyrillic!