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 Rohit Kumar <ro...@gmail.com> on 2013/09/09 07:20:42 UTC

Searching solr on school name during year

Hi,

Currently I have a student search which allows me to search for documents
in a school. I am looking at including year search into the existing schema
which would enable users to search for students in a school during an year.
I have a proposed change in the schema to add the "year" component to
facilitate this search.


Existing schema: (No year information currently)

<field name="id" type="string" indexed="true" stored="true" required="true"
multiValued="false" />
<field name="name" type="text_general" indexed="true" stored="true" />
<field name="schoolName" type="text_general" indexed="true" stored="true"
multiValued="true"/>

Current sample data:
name:Borris Mayers
schoolName:Canterbury University




New schema:

<field name="id" type="string" indexed="true" stored="true" required="true"
multiValued="false" />
<field name="name" type="text_general" indexed="true" stored="true" />
<field name="schoolName" type="text_general" indexed="true" stored="true"
multiValued="true"/>
<field name="schoolNameWithTermOriginal" type="string" indexed="false"
stored="true" multiValued="true"/>


Sample data:

name:Borris Mayers
schoolName:Canterbury University, start_2001, year_2001, year_2002,
year_2003, year_2004, year_2005, end_2005
schoolNameWithTermOriginal:Canterbury University||2001-2005


Please suggest if its a correct approach or there is a better way to do the
same.
I am using Solr 4.3.


Thanks,
Rohit Kumar

Re: Searching solr on school name during year

Posted by "tamanjit.bindra@yahoo.co.in" <ta...@yahoo.co.in>.
You could either add two separate fields, one for start year and another for
end year. And then facilitate range queries to include all docs.
eg. Name - Boris
start year - 2001
end year - 2005



Or you could just have one field and put in multivalued years a student has
attended the school.
name  -boris
year 2001
       2002
       2003
      2004
      2005

I think the second approach would complete your objective



--
View this message in context: http://lucene.472066.n3.nabble.com/Searching-solr-on-school-name-during-year-tp4088817p4088910.html
Sent from the Solr - User mailing list archive at Nabble.com.