Re: Newbie Solr questions
thanks, so there is no way to create custom documents/field via the SolrJ client API @ runtime.? On Nov 16, 2009, at 4:49 PM, Lance Norskog wrote: here is no way to create custom documents/fields via the SolrJ client @ runtime.
Re: Newbie Solr questions
ok, so what I am hearing, there is no way to create custom documents/ fields via the SolrJ client @ runtime. Instead you have to use the schema.xml ahead of time OR create a custom index via the lucene APIs then import the indexes into Solr for searching? On Nov 15, 2009, at 9:16 PM, Peter Wolanin wrote: Take a look at the example schema - you can have dynamic fields that are used based on wildcard matching to the field name if a field doesn't mtach the name of an existing field. -Peter On Sun, Nov 15, 2009 at 10:50 AM, yz5od2 outdo...@yahoo.com> wrote: Thanks for the reply: I follow the schema.xml concept, but what if my requirement is more dynamic in nature? I.E. I would like my developers to be able to annotate a POJO and submit it to the Solr server (embedded) to be indexed according to public properties OR annotations. Is that possible? If that is not possible, can I programatically define documents and fields (and the field options) in straight Java? I.E. in pseudo code below... // this is made up but this is what I would like to be able to do SolrDoc document = new SolrDoc(); SolrField field = new SolrField() field.isIndexed=true; field.isStored=true; field.name = 'myField' field.value = myPOJO.getValue(); solrServer.index(document); On Nov 15, 2009, at 12:50 AM, Avlesh Singh wrote: a) Since Solr is built on top of lucene, using SolrJ, can I still directly create custom documents, specify the field specifics etc (indexed, stored etc) and then map POJOs to those documents, simular to just using the straight lucene API? b) I took a quick look at the SolrJ javadocs but did not see anything in there that allowed me to customize if a field is stored, indexed, not indexed etc. How do I do that with SolrJ without having to go directly to the lucene apis? c) The SolrJ beans package. By annotating a POJO with @Field, how exactly does SolrJ treat that field? Indexed/stored, or just indexed? Is there any other way to control this? The answer to all your questions above is the magical file called schema.xml. For more read here - http://wiki.apache.org/solr/SchemaXml . SolrJ is simply a java client to access (read and update from) the solr server. c) If I create a custom index outside of Solr using straight lucene, is it easy to import a pre-exisiting lucene index into a Solr Server? As long as the Lucene index matches the definitions in your schema you can use the same index. The data however needs to copied into a predictable location inside SOLR_HOME. Cheers Avlesh On Sun, Nov 15, 2009 at 9:26 AM, yz5od2 wrote: Hi, I am new to Solr but fairly advanced with lucene. In the past I have created custom Lucene search engines that indexed objects in a Java application, so my background is coming from this requirement a) Since Solr is built on top of lucene, using SolrJ, can I still directly create custom documents, specify the field specifics etc (indexed, stored etc) and then map POJOs to those documents, simular to just using the straight lucene API? b) I took a quick look at the SolrJ javadocs but did not see anything in there that allowed me to customize if a field is stored, indexed, not indexed etc. How do I do that with SolrJ without having to go directly to the lucene apis? c) The SolrJ beans package. By annotating a POJO with @Field, how exactly does SolrJ treat that field? Indexed/stored, or just indexed? Is there any other way to control this? c) If I create a custom index outside of Solr using straight lucene, is it easy to import a pre-exisiting lucene index into a Solr Server? thanks! -- Peter M. Wolanin, Ph.D. Momentum Specialist, Acquia. Inc. peter.wola...@acquia.com
Re: Newbie Solr questions
Thanks for the reply: I follow the schema.xml concept, but what if my requirement is more dynamic in nature? I.E. I would like my developers to be able to annotate a POJO and submit it to the Solr server (embedded) to be indexed according to public properties OR annotations. Is that possible? If that is not possible, can I programatically define documents and fields (and the field options) in straight Java? I.E. in pseudo code below... // this is made up but this is what I would like to be able to do SolrDoc document = new SolrDoc(); SolrField field = new SolrField() field.isIndexed=true; field.isStored=true; field.name = 'myField' field.value = myPOJO.getValue(); solrServer.index(document); On Nov 15, 2009, at 12:50 AM, Avlesh Singh wrote: a) Since Solr is built on top of lucene, using SolrJ, can I still directly create custom documents, specify the field specifics etc (indexed, stored etc) and then map POJOs to those documents, simular to just using the straight lucene API? b) I took a quick look at the SolrJ javadocs but did not see anything in there that allowed me to customize if a field is stored, indexed, not indexed etc. How do I do that with SolrJ without having to go directly to the lucene apis? c) The SolrJ beans package. By annotating a POJO with @Field, how exactly does SolrJ treat that field? Indexed/stored, or just indexed? Is there any other way to control this? The answer to all your questions above is the magical file called schema.xml. For more read here - http://wiki.apache.org/solr/ SchemaXml. SolrJ is simply a java client to access (read and update from) the solr server. c) If I create a custom index outside of Solr using straight lucene, is it easy to import a pre-exisiting lucene index into a Solr Server? As long as the Lucene index matches the definitions in your schema you can use the same index. The data however needs to copied into a predictable location inside SOLR_HOME. Cheers Avlesh On Sun, Nov 15, 2009 at 9:26 AM, yz5od2 outdo...@yahoo.com>wrote: Hi, I am new to Solr but fairly advanced with lucene. In the past I have created custom Lucene search engines that indexed objects in a Java application, so my background is coming from this requirement a) Since Solr is built on top of lucene, using SolrJ, can I still directly create custom documents, specify the field specifics etc (indexed, stored etc) and then map POJOs to those documents, simular to just using the straight lucene API? b) I took a quick look at the SolrJ javadocs but did not see anything in there that allowed me to customize if a field is stored, indexed, not indexed etc. How do I do that with SolrJ without having to go directly to the lucene apis? c) The SolrJ beans package. By annotating a POJO with @Field, how exactly does SolrJ treat that field? Indexed/stored, or just indexed? Is there any other way to control this? c) If I create a custom index outside of Solr using straight lucene, is it easy to import a pre-exisiting lucene index into a Solr Server? thanks!
Newbie Solr questions
Hi, I am new to Solr but fairly advanced with lucene. In the past I have created custom Lucene search engines that indexed objects in a Java application, so my background is coming from this requirement a) Since Solr is built on top of lucene, using SolrJ, can I still directly create custom documents, specify the field specifics etc (indexed, stored etc) and then map POJOs to those documents, simular to just using the straight lucene API? b) I took a quick look at the SolrJ javadocs but did not see anything in there that allowed me to customize if a field is stored, indexed, not indexed etc. How do I do that with SolrJ without having to go directly to the lucene apis? c) The SolrJ beans package. By annotating a POJO with @Field, how exactly does SolrJ treat that field? Indexed/stored, or just indexed? Is there any other way to control this? c) If I create a custom index outside of Solr using straight lucene, is it easy to import a pre-exisiting lucene index into a Solr Server? thanks!