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 Renato Wesenauer <re...@gmail.com> on 2010/11/08 21:10:55 UTC

Fixed value in dataimporthandler

Hi guys,

I need to indexing some fields with fixed value.

Example:

Schema.xml
<field name="indativo" type="boolean" indexed="true" stored="true"/>

I want to indexing the value 'false' fixed in the dataimporthandler. How do
I do this?

Thank you,

Renato F. Wesenauer

Re: Fixed value in dataimporthandler

Posted by Ahmet Arslan <io...@yahoo.com>.
> Yes, I am.
> 
> <entity name="x" processor="XPathEntityProcessor"
> forEach="/ROW"
> url="${f.fileAbsolutePath}"
> transformer="TemplateTransformer">

Can you post numFound values of these three queries:

q=indativo:true
q=indativo:false
q=secao:"accessories for cars"


      

Re: Fixed value in dataimporthandler

Posted by Renato Wesenauer <re...@gmail.com>.
Yes, I am.

<entity name="x" processor="XPathEntityProcessor" forEach="/ROW"
url="${f.fileAbsolutePath}" transformer="TemplateTransformer">


2010/11/8 Ahmet Arslan <io...@yahoo.com>

> Did you add transformer="TemplateTransformer" to your data-config.xml file?
>
> Also /solr/admin/dataimport.jsp is useful for debugging.
>
> --- On Mon, 11/8/10, Renato Wesenauer <re...@gmail.com> wrote:
>
> > From: Renato Wesenauer <re...@gmail.com>
> > Subject: Re: Fixed value in dataimporthandler
> > To: solr-user@lucene.apache.org
> > Date: Monday, November 8, 2010, 10:50 PM
> > Hi Ahmet Arslan,
> >
> > I'm using this in schema.xml:
> > <field name="secao" type="cleannormalized_text"
> > indexed="true"
> > stored="true"/>
> > <field name="indativo" type="boolean" indexed="true"
> > stored="true"/>
> >
> > I'm using this in dataimporthandler:
> > <field column="secao" xpath="/ROW/NomeSecaoMix" />
> > <field column="indativo" template="0" />
> >
> > The indexing process work correctly, but it's happening
> > something wrong with
> > the results of queries.
> >
> > All queries with some field with 2 words or more, plus the
> > field
> > "indativo:true", it isn't returning any result.
> >
> > Example of queries:
> >
> > 1º) secao:"accessories for cars" AND indativo:true
> > 2º) secao:"accessories for cars" AND indativo:false
> >
> > The first query returns 0 results, but there are 40.000
> > documents indexed
> > with these fields.
> > The second query returns 300.000 documents, but 300.000 is
> > the total of
> > documents for query secao:"celular e telefonia", the
> > correct would be
> > 260.000.
> >
> > Another example:
> > 1º) secao:"toys" AND indativo:true
> > 2º) secao:"toys" AND indativo:false
> >
> > In this example, the two queries work correctly.
> >
> > The problem happens with values with 2 words or more, plus
> > the "indativo"
> > field.
> >
> > Do you know what can be happening?
> >
> > Thank you,
> >
> > Renato F. Wesenauer
> >
> >
> > 2010/11/8 Ahmet Arslan <io...@yahoo.com>
> >
> > > > I need to indexing some fields with fixed value.
> > > >
> > > > Example:
> > > >
> > > > Schema.xml
> > > > <field name="indativo" type="boolean"
> > indexed="true"
> > > > stored="true"/>
> > > >
> > > > I want to indexing the value 'false' fixed in
> > the
> > > > dataimporthandler. How do
> > > > I do this?
> > >
> > > with TemplateTransformer
> > >
> > >
> > >
> http://wiki.apache.org/solr/DataImportHandlerFaq#How_would_I_insert_a_static_value_into_a_field_.3F
> > >
> > >
> > >
> > >
> > >
> >
>
>
>
>

Re: Fixed value in dataimporthandler

Posted by Ken Stanley <do...@gmail.com>.
On Mon, Nov 8, 2010 at 3:50 PM, Renato Wesenauer
<re...@gmail.com> wrote:
>
> Hi Ahmet Arslan,
>
> I'm using this in schema.xml:
> <field name="secao" type="cleannormalized_text" indexed="true"
> stored="true"/>
> <field name="indativo" type="boolean" indexed="true" stored="true"/>
>
> I'm using this in dataimporthandler:
> <field column="secao" xpath="/ROW/NomeSecaoMix" />
> <field column="indativo" template="0" />
>
> The indexing process work correctly, but it's happening something wrong with
> the results of queries.
>
> All queries with some field with 2 words or more, plus the field
> "indativo:true", it isn't returning any result.
>
> Example of queries:
>
> 1º) secao:"accessories for cars" AND indativo:true
> 2º) secao:"accessories for cars" AND indativo:false
>
> The first query returns 0 results, but there are 40.000 documents indexed
> with these fields.
> The second query returns 300.000 documents, but 300.000 is the total of
> documents for query secao:"celular e telefonia", the correct would be
> 260.000.
>
> Another example:
> 1º) secao:"toys" AND indativo:true
> 2º) secao:"toys" AND indativo:false
>
> In this example, the two queries work correctly.
>
> The problem happens with values with 2 words or more, plus the "indativo"
> field.
>
> Do you know what can be happening?
>
> Thank you,
>
> Renato F. Wesenauer
>

Renato,

Correct me if I'm wrong, but you have an entity that you explicitly
set to a false value for the "indativo" field. And when you query, is
your intention to find the fields that were not indexed through that
entity? The way that I am reading your question is that you are
expecting the indativo field to be true by default, but I do not see
where you're explicitly stating that in your schema. The reason that I
bring this up is - and I could be wrong - I would think that if you do
not set a value in SOLR, then it doesn't exist (either in the schema,
or during indexing). If you are expecting the other entries where
indativo was explicitly set to false to be true, you might need to
tweak your schema so that the field definition is by default "true".
Is it possible to try adding the default attribute to your field
definition and reindexing to see if that gives you what you're looking
for?

- Ken Stanley

PS. If this came through twice, I apologize; I got a bounce-back
saying my original reply was blocked, so I'm trying to re-send as
plain text.

Re: Fixed value in dataimporthandler

Posted by Ahmet Arslan <io...@yahoo.com>.
Did you add transformer="TemplateTransformer" to your data-config.xml file?

Also /solr/admin/dataimport.jsp is useful for debugging.

--- On Mon, 11/8/10, Renato Wesenauer <re...@gmail.com> wrote:

> From: Renato Wesenauer <re...@gmail.com>
> Subject: Re: Fixed value in dataimporthandler
> To: solr-user@lucene.apache.org
> Date: Monday, November 8, 2010, 10:50 PM
> Hi Ahmet Arslan,
> 
> I'm using this in schema.xml:
> <field name="secao" type="cleannormalized_text"
> indexed="true"
> stored="true"/>
> <field name="indativo" type="boolean" indexed="true"
> stored="true"/>
> 
> I'm using this in dataimporthandler:
> <field column="secao" xpath="/ROW/NomeSecaoMix" />
> <field column="indativo" template="0" />
> 
> The indexing process work correctly, but it's happening
> something wrong with
> the results of queries.
> 
> All queries with some field with 2 words or more, plus the
> field
> "indativo:true", it isn't returning any result.
> 
> Example of queries:
> 
> 1º) secao:"accessories for cars" AND indativo:true
> 2º) secao:"accessories for cars" AND indativo:false
> 
> The first query returns 0 results, but there are 40.000
> documents indexed
> with these fields.
> The second query returns 300.000 documents, but 300.000 is
> the total of
> documents for query secao:"celular e telefonia", the
> correct would be
> 260.000.
> 
> Another example:
> 1º) secao:"toys" AND indativo:true
> 2º) secao:"toys" AND indativo:false
> 
> In this example, the two queries work correctly.
> 
> The problem happens with values with 2 words or more, plus
> the "indativo"
> field.
> 
> Do you know what can be happening?
> 
> Thank you,
> 
> Renato F. Wesenauer
> 
> 
> 2010/11/8 Ahmet Arslan <io...@yahoo.com>
> 
> > > I need to indexing some fields with fixed value.
> > >
> > > Example:
> > >
> > > Schema.xml
> > > <field name="indativo" type="boolean"
> indexed="true"
> > > stored="true"/>
> > >
> > > I want to indexing the value 'false' fixed in
> the
> > > dataimporthandler. How do
> > > I do this?
> >
> > with TemplateTransformer
> >
> >
> > http://wiki.apache.org/solr/DataImportHandlerFaq#How_would_I_insert_a_static_value_into_a_field_.3F
> >
> >
> >
> >
> >
> 


      

Re: Fixed value in dataimporthandler

Posted by Renato Wesenauer <re...@gmail.com>.
Hi Ahmet Arslan,

I'm using this in schema.xml:
<field name="secao" type="cleannormalized_text" indexed="true"
stored="true"/>
<field name="indativo" type="boolean" indexed="true" stored="true"/>

I'm using this in dataimporthandler:
<field column="secao" xpath="/ROW/NomeSecaoMix" />
<field column="indativo" template="0" />

The indexing process work correctly, but it's happening something wrong with
the results of queries.

All queries with some field with 2 words or more, plus the field
"indativo:true", it isn't returning any result.

Example of queries:

1º) secao:"accessories for cars" AND indativo:true
2º) secao:"accessories for cars" AND indativo:false

The first query returns 0 results, but there are 40.000 documents indexed
with these fields.
The second query returns 300.000 documents, but 300.000 is the total of
documents for query secao:"celular e telefonia", the correct would be
260.000.

Another example:
1º) secao:"toys" AND indativo:true
2º) secao:"toys" AND indativo:false

In this example, the two queries work correctly.

The problem happens with values with 2 words or more, plus the "indativo"
field.

Do you know what can be happening?

Thank you,

Renato F. Wesenauer


2010/11/8 Ahmet Arslan <io...@yahoo.com>

> > I need to indexing some fields with fixed value.
> >
> > Example:
> >
> > Schema.xml
> > <field name="indativo" type="boolean" indexed="true"
> > stored="true"/>
> >
> > I want to indexing the value 'false' fixed in the
> > dataimporthandler. How do
> > I do this?
>
> with TemplateTransformer
>
>
> http://wiki.apache.org/solr/DataImportHandlerFaq#How_would_I_insert_a_static_value_into_a_field_.3F
>
>
>
>
>

Re: Fixed value in dataimporthandler

Posted by Ahmet Arslan <io...@yahoo.com>.
> I need to indexing some fields with fixed value.
> 
> Example:
> 
> Schema.xml
> <field name="indativo" type="boolean" indexed="true"
> stored="true"/>
> 
> I want to indexing the value 'false' fixed in the
> dataimporthandler. How do
> I do this?

with TemplateTransformer

http://wiki.apache.org/solr/DataImportHandlerFaq#How_would_I_insert_a_static_value_into_a_field_.3F