Put the data in two different fields. You can also include a type field and use the fq=type:type1 or fq=type:type2 if you need to distinguish them separately.
Best, Erick On Sun, Sep 15, 2013 at 11:00 AM, Baskar Sikkayan <baskar....@gmail.com>wrote: > Hi Erick, > Thanks a lot for your reply. I am still not clear. > I will have 2 different searches. > So, there will be 2 different kind of documents with different fields. > > But the example below, gives me a impression that > > SolrInputDocument doc = new SolrInputDocument();even there are 2 diff > searches, the data is getting stored in the same > > doc.addField("cat", "book"); > doc.addField("id", "book-" + i); > doc.addField("name", "The Legend of the Hobbit part " + i); > server.add(doc); > > If i use the same doc, how to diff data for 2 different searches. > Could you explain me clear on this??????// > > > Thanks, > Baskar.S > > > > On Sun, Sep 15, 2013 at 7:57 PM, Erick Erickson <erickerick...@gmail.com > >wrote: > > > Listen to Wunder. You really have to switch > > gears and think in terms of searching rather > > than database tables. > > > > First, there's no requirement that all documents > > have the same fields. There's very little penalty > > for this. > > > > Second, you have to get over normalized data. > > It's unclear how many employees/records you have, > > but unless it's a really big set of records (i.e multiple > > tens of millions) you don't have to worry much > > about saving space. > > > > BTW, your java example works, but you do NOT > > want to commit after every document. Configure > > your auto soft and hard commits to do this on a > > time-based basis. > > > > So I'd recommend you approach it differently. > > Don't get stuck on your current data model. Instead > > define the searches you want to make and _then_ > > decide the appropriate fields in the docs. > > > > But to your question, you can certainly create > > two cores. That's a good strategy if there is > > little data shared between the two types of users. > > It's probably conceptually cleaner as well. > > > > Best, > > Erick > > > > > > On Sun, Sep 15, 2013 at 8:18 AM, Baskar Sikkayan <baskar....@gmail.com > > >wrote: > > > > > Hi, > > > Thank you very much for your reply. > > > Let me clearly explain my requirement. > > > > > > Its a kind of job site. > > > > > > I have 2 tables that need to be added in solr. > > > > > > 1) employee ( id, name, skills, location, .....) > > > 2) job_postings ( id, name, job title, description, salary, > date_posted, > > > ....) > > > > > > > > > Here, there are 2 different kind of searches in my application. > > > > > > 1) employee search by employer > > > 2) job postings search by employee > > > > > > New row can be added at any time. Also the existing row can be altered > at > > > any time. For example, employee mobile number can be changed at any > time > > > and the solr data has to be updated. > > > > > > Here there are 2 different searches. So i need to maintain two > different > > > kind of indexes in solr. > > > > > > The java example says, to add a document, below is the sample code. My > > > doubt is, how can i add two different kind of search data here. > > > Should i create a 2 different core for this 2 different searches? > > > > > > SolrInputDocument doc = new SolrInputDocument(); > > > > > > doc.addField("cat", "book"); > > > doc.addField("id", "book-" + i); > > > doc.addField("name", "The Legend of the Hobbit part " + > i); > > > server.add(doc); > > > server.commit(); > > > > > > Thanks, > > > Baskar.S > > > > > > > > > On Sun, Sep 15, 2013 at 9:14 AM, Walter Underwood < > wun...@wunderwood.org > > > >wrote: > > > > > > > Solr does not have tables, and you can't add an index. > > > > > > > > Solr's data model is flat, like a single table with lots of columns. > > > Think > > > > about creating a view where each row has all the information for one > > > search > > > > result. It includes everything that is searched (indexed=true in the > > > > schema) and returned (stored=true in the schema). > > > > > > > > wunder > > > > > > > > On Sep 14, 2013, at 7:32 PM, Amit Jha wrote: > > > > > > > > > Question is not clear to me. Please be more elaborative in your > > query. > > > > Why do u want to store index to DB tables? > > > > > > > > > > Rgds > > > > > AJ > > > > > > > > > > On 15-Sep-2013, at 7:20, Baskar Sikkayan <baskar....@gmail.com> > > wrote: > > > > > > > > > >> How to add index to 3 diff tables from java ... > > > > >> > > > > >> > > > > >> On Sun, Sep 15, 2013 at 6:49 AM, Amit Jha <shanuu....@gmail.com> > > > wrote: > > > > >> > > > > >>> Add a field called "source" in schema.xml and value would be your > > > table > > > > >>> names. > > > > >>> > > > > >>> > > > > >>> > > > > >>> Rgds > > > > >>> AJ > > > > >>> > > > > >>> On 15-Sep-2013, at 5:38, Baskar Sikkayan <baskar....@gmail.com> > > > wrote: > > > > >>> > > > > >>>> Hi, > > > > >>>> I am new to Solr and trying to use Solr java client instead of > > using > > > > the > > > > >>>> Data handler. > > > > >>>> Is there any configuration i need to do for this? > > > > >>>> > > > > >>>> I got the following sample code. > > > > >>>> > > > > >>>> SolrInputDocument doc = new SolrInputDocument(); > > > > >>>> > > > > >>>> doc.addField("cat", "book"); > > > > >>>> doc.addField("id", "book-" + i); > > > > >>>> doc.addField("name", "The Legend of the Hobbit part > " + > > > i); > > > > >>>> server.add(doc); > > > > >>>> server.commit(); // periodically flush > > > > >>>> > > > > >>>> I am confused here. I am going to index 3 different tables for 3 > > > > >>> different > > > > >>>> kind of searches. Here i dont have any option to differentiate 3 > > > kind > > > > of > > > > >>>> indexes. > > > > >>>> Am i missing anything here. Could anyone please shed some light > > > here? > > > > >>>> > > > > >>>> Thanks, > > > > >>>> Baskar.S > > > > >>> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >