I'm new at solr and trying to index database with solr 6.5.1 + postgresql.
Finally it looks successful to index the database.
DataImport screen shows
Indexing completed. Added/Updated: 0 documents. Deleted 0 documents. (Duration: 21m 13s)
Requests: 1 , Fetched: 19,736,915 15,504/s, Skipped: 0 , Processed: 0
Started: about an hour ago
However nothing is showing on Query screen when I pressed "Execute Query" button.
{
"responseHeader":{
"status":0,
"QTime":0,
"params":{
"q":"*:*",
"indent":"on",
"wt":"json",
"_":"1497333923963"}},
"response":{"numFound":0,"start":0,"docs":[]
}}
my database configuration (db-data-config.xml) is like as below.
<dataConfig>
<dataSource driver="org.postgresql.Driver" url="jdbc:postgresql://xxx.xx.xxx.xx:5432/xxxxx" user="xxxxx" password="xxx" />
<document>
<entity name="pubmed" query="select pmid, article_title, abstract from pubmed_xml">
<field column="pmid" name="pmid" />
<field column="article_title" name="article_title" />
<field column="abstract" name="abstract" />
</entity>
</document>
</dataConfig>
Could you guys give me some tips for fixing this issue ?
Thank you in advance.
If you check your schema.xml file, you'll see an entry as follows: <uniqueKey>id</uniqueKey>. This defines the solr field id to be the unique field which is mandatory for all documents in the index. In case you want to use a different field, change the uniqueKey entry and ensure that that particular field (pmid in your case) is defined in the schema.
Anyway, I found the solution to fix it.
I changed the name 'pmid' to 'id' like this.
and it works fine.
It seems that 'id' is used as indexing key inside solr configuration.
please let me know whoever knows the reason.
thank you.
Related
I have a query where I generate a XMLSCHEMA and a XML sample.
SELECT TOP (10)
filename, queue, owner, resubmitFile,
pages, system, created, server, preflightlogs, status, kit, totalkits
FROM
Preflight_analytics
FOR XML AUTO, XMLSCHEMA ('Preflight_analytics')
All my columns have a description associated with it.
Is it possible to get the column description place inside the xsd like the below sample? I use the xsd to generate documentation and the tool I use, uses the tag <xsd:documentation> to add the description to the docs - like below:
<xsd:attribute name="JobID" fixed="" use="required">
<xsd:annotation>
<xsd:documentation xml:lang="en">Vendors unique ID</xsd:documentation>
</xsd:annotation>
<xsd:simpleType>
<xsd:restriction base="sqltypes:varchar" sqltypes:localeId="1033"
sqltypes:sqlCompareOptions="IgnoreCase IgnoreKanaType IgnoreWidth"
sqltypes:sqlSortId="52">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:attribute
I been looking over the docs here haven't found anything yet but still looking.
Thank you
Mike
I am trying to get a list of table-records in my FCE.
In documentation, i found the part "items" can use a Query.
But i can not find a way to make it work.
<flux:field.select name="myRecord" items="NOTHING WORKS HERE" label="Choose" maxItems="1" minItems="1" size="5" multiple="false" />
Does anybody know how the items can be filled with table-records ?
If you are trying to get the select box with all items maybe you can then switch to this:
<flux:field.relation size="1" minItems="0" table="tx_{YourExtensionName}_domain_model_{YourObjectName}" maxItems="1" name="package">
</flux:field.relation>
Of corse, you can use any table from the DB, like "pages"..
Hope it helps!
I am trying to create a mapping file for a fixed length file that contains multiple repeating segments. Problem is, that more than one of these segments are repeated an indefinite number of times, which is not supported by beanio for flat files. I understand, that there is a good reason for this, as beanio can do only so much guesswork about how often a segment repeats.
However the number of repetitions for each segment is present in the file, at a position before the repeating segments occur, so I am trying to figure out whether there is a way to read that number from the stream and then populate the "minOccurs" and "maxOccurs" properties for the following segment with the correct value.
Basically my mapping file looks like:
<beanio>
<stream name="employeeFile" format="fixedlength">
<record name="record1" class="example.Record1">
<field name="field1" length="10"/>
<field name="field2" length="2"/>
<field name="length1" length="2"/>
<segment name="list1" collection="list" minOccurs="1" maxOccurs="unbounded" class="example.List1">
...
</segment>
<field name="length2" length="2"/>
<segment name="list2" collection="list" minOccurs="1" maxOccurs="unbounded" class="example.List2">
...
</segment>
</record>
</stream>
</beanio>
I now need some way to use the value of fields length1 and length2 as "maxOccurs" property in the segments. I am fairly certain that there is no "official" way to get this behavior, but I have so far failed to come up with an even remotely elegant solution for this.
An idea I had was to create a procedure that loads the number of repetitions for each segment from the file and then doing a search-replace on the mapping file, before loading this in beanio, however this seems like a very complicated way of doing things.
Thanks,
Sönke
Found the answer myself. I was reading the beanio reference documentation for version 2.0, not 2.1 which introduced the feature I am looking for.
The reference document states:
If a field repeats a fixed number of times based on a preceding field
in the same record, the occursRef attribute can be used to identify
the name of the controlling field. If the controlling field is not
bound to a separate property of its parent bean object, be sure to
specify ignore="true". The following mapping file shows how to
configure the accounts field occurrences to be dependent on the
numberOfAccounts field. If desired, minOccurs and maxOccurs may still
be specified to validate the referenced field occurrences value.
So one can use:
<field name="accounts" type="int" collection="list" occursRef="numberOfAccounts" />
to get the intended result.
I don't think this property works with xml streams, as it is not really needed here. I accidentally tried to add this in a mapping file and got an exception instead of a proper error message.
I have successfully written a custom function and hooked it into my Solr engine. However, I am having problems passing parameters into that function from within the data-import.xml import definition file.
I have tried to methods, one which passes in a field from the current entity query, and the other approach which tries to use a variable from the last query...no seem to work.
Attempt 1: Pass in columns from current query:
<entity name="doc" query="SELECT id, date, ${dataimporter.functions.myfunc(id,date)} AS custom_value FROM Documents" />
This doesn't work as id and date seem to be passed in as literals, not the column values.
Attempt 2:
<entity name="doc" query="SELECT id, date FROM Documents">
<entity name="special" query="SELECT ${dataimporter.functions.myfunc(${doc.id}, ${doc.date})} AS custom_value" >
<field name="custom_value" column="custom_value" />
</entity>
</entity>
This doesn't work because it gets confused from the variable within the variable.
Any suggestions on how to make this work?
Try
<entity name="doc" query="SELECT id, date, ${dataimporter.functions.myfunc(doc.id,doc.date)} AS custom_value FROM Documents" />
An other way to generate custom_value is using transformer tag
in transformer_row you can add more column to the row or write custom function to transform if you want.
I have a sitecore 6.2 site that had no lucene indexes besides the system index. I tried to add this new simple index:
<index id="videoIndex" type="Sitecore.Search.Index, Sitecore.Kernel" >
<param desc="name">$(id)</param>
<param desc="folder">IndexFolder</param>
<Analyzer ref="search/analyzer" />
<templates hint="list:AddTemplate">
<template>{854D2F45-3261-45A8-9E52-64D96B5D54E5}</template>
</templates>
<fields hint="raw:AddField">
<field target="category">Categories</field>
<field target="date">__updated</field>
</fields>
</index>
Once I add this, browsing to any page on the sitecore site gives the following error:
Could not find add method: AddTemplate (type: Sitecore.Search.Index)
Using lucene 2.3.1.3, .NET 3.5.
The 'type' attribute of the <index/> element references Sitecore.Search.Index class, which doesn't contain methods like AddTemplate and AddField. It seems you should reference Sitecore.Data.Indexing.Index instead. Take a look at <index id="system" ... /> in web.config.
Hope this helps.