Here´s the solution: <entity name="ci_project" query="select pr_id, pr_name, pr_comment, 'dataci_project' from ci_project WHERE pr_id = 1"> <field column="dataci_project" name="definition" />
</entity> just insert a dummy sql field 'dataci_project' in your select statement. Glen Newton wrote: > > In MySql at least, you can do achieve what I think you want by > manipulating the SQL, like this: > > mysql> select "foo" as Constant1, id from Article limit 10; > select "foo" as Constant1, id from Article limit 10; > +-----------+----+ > | Constant1 | id | > +-----------+----+ > | foo | 1 | > | foo | 2 | > | foo | 3 | > | foo | 4 | > | foo | 5 | > | foo | 6 | > | foo | 7 | > | foo | 8 | > | foo | 9 | > | foo | 10 | > +-----------+----+ > 10 rows in set (0.00 sec) > > mysql> select 435 as Constant2, id from Article limit 10; > select 435 as Constant2, id from Article limit 10; > +-----------+----+ > | Constant2 | id | > +-----------+----+ > | 435 | 1 | > | 435 | 2 | > | 435 | 3 | > | 435 | 4 | > | 435 | 5 | > | 435 | 6 | > | 435 | 7 | > | 435 | 8 | > | 435 | 9 | > | 435 | 10 | > +-----------+----+ > 10 rows in set (0.00 sec) > > mysql> > > 2009/4/8 Shalin Shekhar Mangar <shalinman...@gmail.com>: >> On Wed, Apr 8, 2009 at 10:23 PM, gateway0 <reiterwo...@yahoo.de> wrote: >> >>> >>> The problem as you see is the line: >>> "<field name="definition">Projects</field>" >>> >>> I want to set a constant value for every row in the SQL table but it >>> doesn´t >>> work that way, any ideas? >>> >> >> That is not a valid syntax. >> >> There are two ways to do this: >> 1. In your schema.xml provide the 'default' attribute >> 2. Use TemplateTransformer - see >> http://wiki.apache.org/solr/DataImportHandlerFaq >> >> -- >> Regards, >> Shalin Shekhar Mangar. >> > > > > -- > > - > > -- View this message in context: http://www.nabble.com/Using-constants-with-DataImportHandler-and-MySQL---tp22954954p22969123.html Sent from the Solr - User mailing list archive at Nabble.com.