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 Rick Leir <rl...@leirtech.com> on 2018/04/01 18:10:06 UTC
Re: Need help to get started on Solr, searching get nothing. Thank you very much in advance
Raymond
The output is not visible to me because the mailing list strips images. Please try a different way to show the output.
Cheers -- Rick
On March 29, 2018 10:17:13 PM EDT, Raymond Xie <xi...@gmail.com> wrote:
> I am new to Solr, following Steve Rowe's example on
>https://github.com/apache/lucene-solr/tree/master/solr/example/films:
>
>It would be greatly appreciated if anyone can enlighten me where to
>start
>troubleshooting, thank you very much in advance.
>
>The steps I followed are:
>
> Here ya go << END_OF_SCRIPT
>
>bin/solr stop
>rm server/logs/*.log
>rm -Rf server/solr/films/
>bin/solr start
>bin/solr create -c films
>curl http://localhost:8983/solr/films/schema -X POST -H
>'Content-type:application/json' --data-binary '{
> "add-field" : {
> "name":"name",
> "type":"text_general",
> "multiValued":false,
> "stored":true
> },
> "add-field" : {
> "name":"initial_release_date",
> "type":"pdate",
> "stored":true
> }
>}'
>bin/post -c films example/films/films.json
>curl http://localhost:8983/solr/films/config/params -H
>'Content-type:application/json' -d '{
>"update" : {
> "facets": {
> "facet.field":"genre"
> }
> }
>}'
>
># END_OF_SCRIPT
>
>Additional fun -
>
>Add highlighting:
>curl http://localhost:8983/solr/films/config/params -H
>'Content-type:application/json' -d '{
>"set" : {
> "browse": {
> "hl":"on",
> "hl.fl":"name"
> }
> }
>}'
>try http://localhost:8983/solr/films/browse?q=batman now, and you'll
>see "batman" highlighted in the results
>
>
>
>I got nothing in my search:
>
>
>
>
>*------------------------------------------------*
>*Sincerely yours,*
>
>
>*Raymond*
--
Sorry for being brief. Alternate email is rickleir at yahoo dot com
Re: Need help to get started on Solr, searching get nothing. Thank
you very much in advance
Posted by Raymond Xie <xi...@gmail.com>.
I have the data ready for index now, it is a json file:
{"122": "20180320-08:08:35.038", "49": "VIPER", "382": "0", "151": "1.0",
"9": "653", "10071": "20180320-08:08:35.088", "15": "JPY", "56": "XSVC",
"54": "1", "10202": "APMKTMAKING", "10537": "XOSE", "10217": "Y", "48":
"179492540", "201": "1", "40": "2", "8": "FIX.4.4", "167": "OPT", "421":
"JPN", "10292": "115", "10184": "337912000000002", "456": "101", "11210":
"337912000000002", "1133": "G", "10515": "178", "10": "200", "11032": "-1",
"10436": "20180320-08:08:35.038", "10518": "178", "11":
"337912000000002", "75":
"20180320", "10005": "178", "10104": "Y", "35": "RIO", "10208":
"APAC.VIPER.OOE", "59": "0", "60": "20180320-08:08:35.088", "528": "P",
"581": "13", "1": "TEST", "202": "25375.0", "455": "179492540", "55":
"JNI253D8.OS", "100": "XOSE", "52": "20180320-08:08:35.088", "10241":
"viperooe", "150": "A", "10039": "viperooe", "39": "A", "10438": "RIO.4.5",
"38": "1", "37": "337912000000002", "372": "D", "660": "102", "44": "2.0",
"10066": "20180320-08:08:35.038", "29": "4", "50": "JPNIK01", "22": "101"}
You can inspect the json here: https://jsonformatter.org/
I need to create index and enable searching on tags: 37, 75 and 10242
(where available, this sample message doesn't have it)
My understanding is I need to create the file managed-schema, I added two
fields as below:
<field name="order_id" type="text_general" indexed="true" stored="false"
multiValued="true"/>
<field name="trd_date" type="text_general" indexed="true"
stored="false" multiValued="true"/>
Then I go back to Solr Admin, I don't see the two new fields in Schema
section
Anything I am missing here? and once the two fields are put in the
managed-schema, can I add the json file through upload in Solr Admin?
Thank you very much.
*------------------------------------------------*
*Sincerely yours,*
*Raymond*
On Mon, Apr 2, 2018 at 9:04 AM, Rick Leir <rl...@leirtech.com> wrote:
> Raymond
> There is a default field normally called df. You would normally use
> Copyfield to copy all searchable fields into the default field.
> Cheers -- Rick
>
> On April 1, 2018 11:34:07 PM EDT, Raymond Xie <xi...@gmail.com>
> wrote:
> >Hi Rick,
> >
> >I sorted it out half:
> >
> >I should have specified the field in the search query, so, instead of
> >http://localhost:8983/solr/films/browse?q=batman, I should use:
> >http://localhost:8983/solr/films/browse?q=name:batman
> >
> >Sorry for this newbie mistake.
> >
> >But what about if I/user doesn't know or doesn't want to specify the
> >search
> >scope to be restricted in field "name" but anywhere in the index'ed
> >documents?
> >
> >
> >*------------------------------------------------*
> >*Sincerely yours,*
> >
> >
> >*Raymond*
> >
> >On Sun, Apr 1, 2018 at 2:10 PM, Rick Leir <rl...@leirtech.com> wrote:
> >
> >> Raymond
> >> The output is not visible to me because the mailing list strips
> >images.
> >> Please try a different way to show the output.
> >> Cheers -- Rick
> >>
> >> On March 29, 2018 10:17:13 PM EDT, Raymond Xie <xi...@gmail.com>
> >> wrote:
> >> > I am new to Solr, following Steve Rowe's example on
> >>
> >>https://github.com/apache/lucene-solr/tree/master/solr/example/films:
> >> >
> >> >It would be greatly appreciated if anyone can enlighten me where to
> >> >start
> >> >troubleshooting, thank you very much in advance.
> >> >
> >> >The steps I followed are:
> >> >
> >> > Here ya go << END_OF_SCRIPT
> >> >
> >> >bin/solr stop
> >> >rm server/logs/*.log
> >> >rm -Rf server/solr/films/
> >> >bin/solr start
> >> >bin/solr create -c films
> >> >curl http://localhost:8983/solr/films/schema -X POST -H
> >> >'Content-type:application/json' --data-binary '{
> >> > "add-field" : {
> >> > "name":"name",
> >> > "type":"text_general",
> >> > "multiValued":false,
> >> > "stored":true
> >> > },
> >> > "add-field" : {
> >> > "name":"initial_release_date",
> >> > "type":"pdate",
> >> > "stored":true
> >> > }
> >> >}'
> >> >bin/post -c films example/films/films.json
> >> >curl http://localhost:8983/solr/films/config/params -H
> >> >'Content-type:application/json' -d '{
> >> >"update" : {
> >> > "facets": {
> >> > "facet.field":"genre"
> >> > }
> >> > }
> >> >}'
> >> >
> >> ># END_OF_SCRIPT
> >> >
> >> >Additional fun -
> >> >
> >> >Add highlighting:
> >> >curl http://localhost:8983/solr/films/config/params -H
> >> >'Content-type:application/json' -d '{
> >> >"set" : {
> >> > "browse": {
> >> > "hl":"on",
> >> > "hl.fl":"name"
> >> > }
> >> > }
> >> >}'
> >> >try http://localhost:8983/solr/films/browse?q=batman now, and you'll
> >> >see "batman" highlighted in the results
> >> >
> >> >
> >> >
> >> >I got nothing in my search:
> >> >
> >> >
> >> >
> >> >
> >> >*------------------------------------------------*
> >> >*Sincerely yours,*
> >> >
> >> >
> >> >*Raymond*
> >>
> >> --
> >> Sorry for being brief. Alternate email is rickleir at yahoo dot com
>
> --
> Sorry for being brief. Alternate email is rickleir at yahoo dot com
Re: Need help to get started on Solr, searching get nothing. Thank
you very much in advance
Posted by Shawn Heisey <ap...@elyograg.org>.
On 4/2/2018 9:00 PM, Raymond Xie wrote:
> I see there is "/browse" in solrconfig.xml :
>
> <requestHandler name="/browse" class="solr.SearchHandler"
> useParams="query,facets,velocity,browse">
> <lst name="defaults">
> <str name="echoParams">explicit</str>
> </lst>
> </requestHandler>
>
> and name="defaults" with one item of "df" as shown below:
> <initParams
> path="/update/**,/query,/select,/tvrh,/elevate,/spell,/browse">
> <lst name="defaults">
> <str name="df">_text_</str>
> </lst>
> </initParams>
>
> My understanding is I can put whatever fields I want to enable index and
> searching here in parallel with <str name="df">_text_</str>, am I correct?
Be careful with the /browse handler. It is not intended for production
use. The primary reason is that in order for /browse to work, the end
user must have direct access to the Solr server -- the /browse handler
instructs the user's browser to make direct calls to Solr's API. Those
calls do not happen server side. The /browse handler serves as an
example of Solr's capability.
Giving end users direct access to Solr, unless you put an intelligent
proxy in between them that can block undesirable requests, is a security
risk. Configuring such a proxy is not a trivial exercise.
The standard query parser uses the df parameter (default field) to
indicate which field to search when no field is given. The df parameter
can only use ONE field. The dismax and edismax parsers have qf, pf, and
friends, to specify multiple fields to query.
Thanks,
Shawn
Re: Need help to get started on Solr, searching get nothing. Thank
you very much in advance
Posted by Raymond Xie <xi...@gmail.com>.
Thanks Rick and Adhyan
I see there is "/browse" in solrconfig.xml :
<requestHandler name="/browse" class="solr.SearchHandler"
useParams="query,facets,velocity,browse">
<lst name="defaults">
<str name="echoParams">explicit</str>
</lst>
</requestHandler>
and name="defaults" with one item of "df" as shown below:
<initParams
path="/update/**,/query,/select,/tvrh,/elevate,/spell,/browse">
<lst name="defaults">
<str name="df">_text_</str>
</lst>
</initParams>
My understanding is I can put whatever fields I want to enable index and
searching here in parallel with <str name="df">_text_</str>, am I correct?
Thanks.
*------------------------------------------------*
*Sincerely yours,*
*Raymond*
On Mon, Apr 2, 2018 at 3:24 PM, Adhyan Arizki <a....@gmail.com> wrote:
> Raymond,
>
> You can specify the default behavior in solrconfig.xml under each handler.
> For instance for /browse you can specify it should look into name, and for
> /query you can default it to different field.
>
> On Mon, Apr 2, 2018 at 9:04 PM, Rick Leir <rl...@leirtech.com> wrote:
>
> > Raymond
> > There is a default field normally called df. You would normally use
> > Copyfield to copy all searchable fields into the default field.
> > Cheers -- Rick
> >
> > On April 1, 2018 11:34:07 PM EDT, Raymond Xie <xi...@gmail.com>
> > wrote:
> > >Hi Rick,
> > >
> > >I sorted it out half:
> > >
> > >I should have specified the field in the search query, so, instead of
> > >http://localhost:8983/solr/films/browse?q=batman, I should use:
> > >http://localhost:8983/solr/films/browse?q=name:batman
> > >
> > >Sorry for this newbie mistake.
> > >
> > >But what about if I/user doesn't know or doesn't want to specify the
> > >search
> > >scope to be restricted in field "name" but anywhere in the index'ed
> > >documents?
> > >
> > >
> > >*------------------------------------------------*
> > >*Sincerely yours,*
> > >
> > >
> > >*Raymond*
> > >
> > >On Sun, Apr 1, 2018 at 2:10 PM, Rick Leir <rl...@leirtech.com> wrote:
> > >
> > >> Raymond
> > >> The output is not visible to me because the mailing list strips
> > >images.
> > >> Please try a different way to show the output.
> > >> Cheers -- Rick
> > >>
> > >> On March 29, 2018 10:17:13 PM EDT, Raymond Xie <xi...@gmail.com>
> > >> wrote:
> > >> > I am new to Solr, following Steve Rowe's example on
> > >>
> > >>https://github.com/apache/lucene-solr/tree/master/solr/example/films:
> > >> >
> > >> >It would be greatly appreciated if anyone can enlighten me where to
> > >> >start
> > >> >troubleshooting, thank you very much in advance.
> > >> >
> > >> >The steps I followed are:
> > >> >
> > >> > Here ya go << END_OF_SCRIPT
> > >> >
> > >> >bin/solr stop
> > >> >rm server/logs/*.log
> > >> >rm -Rf server/solr/films/
> > >> >bin/solr start
> > >> >bin/solr create -c films
> > >> >curl http://localhost:8983/solr/films/schema -X POST -H
> > >> >'Content-type:application/json' --data-binary '{
> > >> > "add-field" : {
> > >> > "name":"name",
> > >> > "type":"text_general",
> > >> > "multiValued":false,
> > >> > "stored":true
> > >> > },
> > >> > "add-field" : {
> > >> > "name":"initial_release_date",
> > >> > "type":"pdate",
> > >> > "stored":true
> > >> > }
> > >> >}'
> > >> >bin/post -c films example/films/films.json
> > >> >curl http://localhost:8983/solr/films/config/params -H
> > >> >'Content-type:application/json' -d '{
> > >> >"update" : {
> > >> > "facets": {
> > >> > "facet.field":"genre"
> > >> > }
> > >> > }
> > >> >}'
> > >> >
> > >> ># END_OF_SCRIPT
> > >> >
> > >> >Additional fun -
> > >> >
> > >> >Add highlighting:
> > >> >curl http://localhost:8983/solr/films/config/params -H
> > >> >'Content-type:application/json' -d '{
> > >> >"set" : {
> > >> > "browse": {
> > >> > "hl":"on",
> > >> > "hl.fl":"name"
> > >> > }
> > >> > }
> > >> >}'
> > >> >try http://localhost:8983/solr/films/browse?q=batman now, and you'll
> > >> >see "batman" highlighted in the results
> > >> >
> > >> >
> > >> >
> > >> >I got nothing in my search:
> > >> >
> > >> >
> > >> >
> > >> >
> > >> >*------------------------------------------------*
> > >> >*Sincerely yours,*
> > >> >
> > >> >
> > >> >*Raymond*
> > >>
> > >> --
> > >> Sorry for being brief. Alternate email is rickleir at yahoo dot com
> >
> > --
> > Sorry for being brief. Alternate email is rickleir at yahoo dot com
> >
>
>
>
> --
>
> Best regards,
> Adhyan Arizki
>
Re: Need help to get started on Solr, searching get nothing. Thank
you very much in advance
Posted by Adhyan Arizki <a....@gmail.com>.
Raymond,
You can specify the default behavior in solrconfig.xml under each handler.
For instance for /browse you can specify it should look into name, and for
/query you can default it to different field.
On Mon, Apr 2, 2018 at 9:04 PM, Rick Leir <rl...@leirtech.com> wrote:
> Raymond
> There is a default field normally called df. You would normally use
> Copyfield to copy all searchable fields into the default field.
> Cheers -- Rick
>
> On April 1, 2018 11:34:07 PM EDT, Raymond Xie <xi...@gmail.com>
> wrote:
> >Hi Rick,
> >
> >I sorted it out half:
> >
> >I should have specified the field in the search query, so, instead of
> >http://localhost:8983/solr/films/browse?q=batman, I should use:
> >http://localhost:8983/solr/films/browse?q=name:batman
> >
> >Sorry for this newbie mistake.
> >
> >But what about if I/user doesn't know or doesn't want to specify the
> >search
> >scope to be restricted in field "name" but anywhere in the index'ed
> >documents?
> >
> >
> >*------------------------------------------------*
> >*Sincerely yours,*
> >
> >
> >*Raymond*
> >
> >On Sun, Apr 1, 2018 at 2:10 PM, Rick Leir <rl...@leirtech.com> wrote:
> >
> >> Raymond
> >> The output is not visible to me because the mailing list strips
> >images.
> >> Please try a different way to show the output.
> >> Cheers -- Rick
> >>
> >> On March 29, 2018 10:17:13 PM EDT, Raymond Xie <xi...@gmail.com>
> >> wrote:
> >> > I am new to Solr, following Steve Rowe's example on
> >>
> >>https://github.com/apache/lucene-solr/tree/master/solr/example/films:
> >> >
> >> >It would be greatly appreciated if anyone can enlighten me where to
> >> >start
> >> >troubleshooting, thank you very much in advance.
> >> >
> >> >The steps I followed are:
> >> >
> >> > Here ya go << END_OF_SCRIPT
> >> >
> >> >bin/solr stop
> >> >rm server/logs/*.log
> >> >rm -Rf server/solr/films/
> >> >bin/solr start
> >> >bin/solr create -c films
> >> >curl http://localhost:8983/solr/films/schema -X POST -H
> >> >'Content-type:application/json' --data-binary '{
> >> > "add-field" : {
> >> > "name":"name",
> >> > "type":"text_general",
> >> > "multiValued":false,
> >> > "stored":true
> >> > },
> >> > "add-field" : {
> >> > "name":"initial_release_date",
> >> > "type":"pdate",
> >> > "stored":true
> >> > }
> >> >}'
> >> >bin/post -c films example/films/films.json
> >> >curl http://localhost:8983/solr/films/config/params -H
> >> >'Content-type:application/json' -d '{
> >> >"update" : {
> >> > "facets": {
> >> > "facet.field":"genre"
> >> > }
> >> > }
> >> >}'
> >> >
> >> ># END_OF_SCRIPT
> >> >
> >> >Additional fun -
> >> >
> >> >Add highlighting:
> >> >curl http://localhost:8983/solr/films/config/params -H
> >> >'Content-type:application/json' -d '{
> >> >"set" : {
> >> > "browse": {
> >> > "hl":"on",
> >> > "hl.fl":"name"
> >> > }
> >> > }
> >> >}'
> >> >try http://localhost:8983/solr/films/browse?q=batman now, and you'll
> >> >see "batman" highlighted in the results
> >> >
> >> >
> >> >
> >> >I got nothing in my search:
> >> >
> >> >
> >> >
> >> >
> >> >*------------------------------------------------*
> >> >*Sincerely yours,*
> >> >
> >> >
> >> >*Raymond*
> >>
> >> --
> >> Sorry for being brief. Alternate email is rickleir at yahoo dot com
>
> --
> Sorry for being brief. Alternate email is rickleir at yahoo dot com
>
--
Best regards,
Adhyan Arizki
Re: Need help to get started on Solr, searching get nothing. Thank you very much in advance
Posted by Rick Leir <rl...@leirtech.com>.
Raymond
There is a default field normally called df. You would normally use Copyfield to copy all searchable fields into the default field.
Cheers -- Rick
On April 1, 2018 11:34:07 PM EDT, Raymond Xie <xi...@gmail.com> wrote:
>Hi Rick,
>
>I sorted it out half:
>
>I should have specified the field in the search query, so, instead of
>http://localhost:8983/solr/films/browse?q=batman, I should use:
>http://localhost:8983/solr/films/browse?q=name:batman
>
>Sorry for this newbie mistake.
>
>But what about if I/user doesn't know or doesn't want to specify the
>search
>scope to be restricted in field "name" but anywhere in the index'ed
>documents?
>
>
>*------------------------------------------------*
>*Sincerely yours,*
>
>
>*Raymond*
>
>On Sun, Apr 1, 2018 at 2:10 PM, Rick Leir <rl...@leirtech.com> wrote:
>
>> Raymond
>> The output is not visible to me because the mailing list strips
>images.
>> Please try a different way to show the output.
>> Cheers -- Rick
>>
>> On March 29, 2018 10:17:13 PM EDT, Raymond Xie <xi...@gmail.com>
>> wrote:
>> > I am new to Solr, following Steve Rowe's example on
>>
>>https://github.com/apache/lucene-solr/tree/master/solr/example/films:
>> >
>> >It would be greatly appreciated if anyone can enlighten me where to
>> >start
>> >troubleshooting, thank you very much in advance.
>> >
>> >The steps I followed are:
>> >
>> > Here ya go << END_OF_SCRIPT
>> >
>> >bin/solr stop
>> >rm server/logs/*.log
>> >rm -Rf server/solr/films/
>> >bin/solr start
>> >bin/solr create -c films
>> >curl http://localhost:8983/solr/films/schema -X POST -H
>> >'Content-type:application/json' --data-binary '{
>> > "add-field" : {
>> > "name":"name",
>> > "type":"text_general",
>> > "multiValued":false,
>> > "stored":true
>> > },
>> > "add-field" : {
>> > "name":"initial_release_date",
>> > "type":"pdate",
>> > "stored":true
>> > }
>> >}'
>> >bin/post -c films example/films/films.json
>> >curl http://localhost:8983/solr/films/config/params -H
>> >'Content-type:application/json' -d '{
>> >"update" : {
>> > "facets": {
>> > "facet.field":"genre"
>> > }
>> > }
>> >}'
>> >
>> ># END_OF_SCRIPT
>> >
>> >Additional fun -
>> >
>> >Add highlighting:
>> >curl http://localhost:8983/solr/films/config/params -H
>> >'Content-type:application/json' -d '{
>> >"set" : {
>> > "browse": {
>> > "hl":"on",
>> > "hl.fl":"name"
>> > }
>> > }
>> >}'
>> >try http://localhost:8983/solr/films/browse?q=batman now, and you'll
>> >see "batman" highlighted in the results
>> >
>> >
>> >
>> >I got nothing in my search:
>> >
>> >
>> >
>> >
>> >*------------------------------------------------*
>> >*Sincerely yours,*
>> >
>> >
>> >*Raymond*
>>
>> --
>> Sorry for being brief. Alternate email is rickleir at yahoo dot com
--
Sorry for being brief. Alternate email is rickleir at yahoo dot com
Re: Need help to get started on Solr, searching get nothing. Thank
you very much in advance
Posted by Raymond Xie <xi...@gmail.com>.
Hi Rick,
I sorted it out half:
I should have specified the field in the search query, so, instead of
http://localhost:8983/solr/films/browse?q=batman, I should use:
http://localhost:8983/solr/films/browse?q=name:batman
Sorry for this newbie mistake.
But what about if I/user doesn't know or doesn't want to specify the search
scope to be restricted in field "name" but anywhere in the index'ed
documents?
*------------------------------------------------*
*Sincerely yours,*
*Raymond*
On Sun, Apr 1, 2018 at 2:10 PM, Rick Leir <rl...@leirtech.com> wrote:
> Raymond
> The output is not visible to me because the mailing list strips images.
> Please try a different way to show the output.
> Cheers -- Rick
>
> On March 29, 2018 10:17:13 PM EDT, Raymond Xie <xi...@gmail.com>
> wrote:
> > I am new to Solr, following Steve Rowe's example on
> >https://github.com/apache/lucene-solr/tree/master/solr/example/films:
> >
> >It would be greatly appreciated if anyone can enlighten me where to
> >start
> >troubleshooting, thank you very much in advance.
> >
> >The steps I followed are:
> >
> > Here ya go << END_OF_SCRIPT
> >
> >bin/solr stop
> >rm server/logs/*.log
> >rm -Rf server/solr/films/
> >bin/solr start
> >bin/solr create -c films
> >curl http://localhost:8983/solr/films/schema -X POST -H
> >'Content-type:application/json' --data-binary '{
> > "add-field" : {
> > "name":"name",
> > "type":"text_general",
> > "multiValued":false,
> > "stored":true
> > },
> > "add-field" : {
> > "name":"initial_release_date",
> > "type":"pdate",
> > "stored":true
> > }
> >}'
> >bin/post -c films example/films/films.json
> >curl http://localhost:8983/solr/films/config/params -H
> >'Content-type:application/json' -d '{
> >"update" : {
> > "facets": {
> > "facet.field":"genre"
> > }
> > }
> >}'
> >
> ># END_OF_SCRIPT
> >
> >Additional fun -
> >
> >Add highlighting:
> >curl http://localhost:8983/solr/films/config/params -H
> >'Content-type:application/json' -d '{
> >"set" : {
> > "browse": {
> > "hl":"on",
> > "hl.fl":"name"
> > }
> > }
> >}'
> >try http://localhost:8983/solr/films/browse?q=batman now, and you'll
> >see "batman" highlighted in the results
> >
> >
> >
> >I got nothing in my search:
> >
> >
> >
> >
> >*------------------------------------------------*
> >*Sincerely yours,*
> >
> >
> >*Raymond*
>
> --
> Sorry for being brief. Alternate email is rickleir at yahoo dot com