How to index data from mongodb to solr 4.7 - mongodb

Does anyone know how to index data from mongodb into solr i've followed previous procedure which was mentioned here
can anyone give a step by step procedure to fix this issue,
here the scripts
on mydataconfig.xml
<dataConfig>
<dataSource name="MyMongo" type="MongoDataSource" database="test" />
<document name="Products">
<entity processor="MongoEntityProcessor"
query="{'Active':1}"
collection="testusers"
datasource="MyMongo"
transformer="MongoMapperTransformer" >
<field column="name" name="name" mongoField="name"/>
<field column="position" name="position" mongoField="position"/>
</entity>
</document>
and in solrconfig.xml
<lib dir="../../lib/" regex="solr-mongo-importer.jar" />
<lib dir="../../lib/" regex="mongo.jar" />
......
<requestHandler name="/dataimport" class="org.apache.solr.handler.dataimport.DataImportHandler">
<lst name="defaults">
<str name="config">mydataconfig.xml</str>
</lst> </requestHandler>
Note: when i checked in solr\admin (in console)
GET:http://localhost:8983/solr/suggest/admin/ping?action=status&wt=json&_=1417082932028 : 503 service not available"
and in dataimport section
TypeError: $(...).attr(...) is undefined in dataimport.js
it works well for other cores i've created in same solr which connects to mysql db.

Related

How to exclude some attribute from fetch xml but Retrieve all other attributes

I want to retrieve all attributes of entity but exclude some of them.
Like if entity have 42 attributes I want to exclude Name, Date and retrieve all others. Below is what i have tried.
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
<entity name="account" >
<all-attributes/>
!<attribute name="name" />!
<order attribute="statecode" descending="false" />
<filter type="and" >
<condition attribute="statecode" operator="eq" value="0" />
<condition attribute="location" operator="eq" uitype="location" value="{11c43ee8-b9d3-4e51-b73f-bd9dda66e29c}" />
</filter>
</entity>
</fetch>
You should remove <all-attributes/> node and add all the attributes you want into the fetchXML.
The fetchXml should look like:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false" >
<entity name="account" >
<attribute name="a"/>
<attribute name="b"/>
<attribute name="c"/>
<attribute name="d"/>
<order attribute="statecode" descending="false" />
<filter type="and" >
<condition attribute="statecode" operator="eq" value="0" />
<condition attribute="location" operator="eq" uitype="location" value="{11c43ee8-b9d3-4e51-b73f-bd9dda66e29c}" />
</filter>
</entity>
</fetch>
Here are some ways to generate a fetchXml:
Download from Advance find. You can download the fetchXml after you added the columns and conditions you want.
Use the FetchXML Builder.
Use Dataverse REST Builder

WSO2 MongoDB GridFS

I am new to WSO2. I'm using wso2ei-6.5.0. I'm trying to add MongoDB GridFS interaction to a data service I already have working with MongoDB. I'm not finding any information in the WSO2 documentation. Does anyone have any samples that can help me?
Working MongoDB data service code. This will only insert documents into normal Mongo collections, not the GridFS collection where binary data gets stored in chunks.
<data name="MongoDB" serviceGroup="" serviceNamespace="">
<description/>
<config id="MongoAudit">
<property name="mongoDB_servers">localhost</property>
<property name="mongoDB_database">audit</property>
<property name="mongoDB_write_concern">FSYNC_SAFE</property>
<property name="mongoDB_read_preference">PRIMARY</property>
<property name="mongoDB_maxWaitTime">60000</property>
</config>
<query id="mongoInsertAudit" useConfig="MongoAudit">
<expression>mycollection.insert("{ correlation_id: #, flowname: #, payload: #}")</expression>
<param name="correlation_id" sqlType="STRING"/>
<param name="flowname" sqlType="STRING"/>
<param name="payload" sqlType="STRING"/>
<result element="UpdatedRowCount" rowName="Row" useColumnNumbers="true" outputType="XML">
<element column="1" name="Value" exportType="SCALAR" xsdType="xs:integer"/>
</result>
</query>
<operation name="mongoInsertAuditOp">
<call-query href="mongoInsertAudit">
<with-param name="correlation_id" query-param="correlation_id"/>
<with-param name="flowname" query-param="flowname"/>
<with-param name="payload" query-param="payload"/>
</call-query>
</operation>

How to use 'in' operator in 'or' filter in Fetchxml based report?

I am using following xml in an Fetch based report in SSRS for Dynamics 365. I've allowed #transaction parameter to null but rest of the both parameters must have values. So, I put an or condition so that if #transaction is null or 0 then on the base of 1 and 2 grab the orders. I've total 10 records but they are not being shown or the report preivew show 0 records. Any idea how to resolve this?
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="salesorder">
<attribute name="salesorderid" />
<attribute name="ordernumber" />
<order attribute="ordernumber" descending="true" />
<filter type="and">
<condition attribute="new_transaction" operator="eq" value="#transaction" />
<condition attribute="createdon" operator="on-or-before" value="#To" />
<condition attribute="createdon" operator="on-or-after" value="#From" />
</filter>
<filter type="or">
<condition attribute="new_transaction" operator="in" >
<value>1</value>
<value>2</value>
</condition>
</filter>
</entity>
</fetch>
If I understood correctly, you can replace your filter like below to get result.
<filter type="and">
<condition attribute="createdon" operator="on-or-before" value="#To" />
<condition attribute="createdon" operator="on-or-after" value="#From" />
<filter type="or">
<condition attribute="new_transaction" operator="in" >
<value>1</value>
<value>2</value>
</condition>
<condition attribute="new_transaction" operator="eq" value="#transaction" />
</filter>
</filter>
Pro tips:
1.Build the query in Advanced find, test the result & Download fetchxml from there to use in report.
2.If you write SQL query, transform it to fetchxml using Kingswaysoft sql2fetchxml free online converter.
3.Read this article to transform fetchxml into Adv find query.
<filter type="or">
<condition attribute="new_transaction" operator="in" value=#parm>
</condition>
</filter>
*work for multiple values

Solr DataImportHandler ERROR DocBuilder Exception while processing

I have been trying to get Solr DIH working with PostgreSQL for hours now and I cannot find the problem, as the Logger doesn't not tell me anthing helpful.
My aim is as simple as to synchronize the data from the database with Solr (using the DIH).
My setup is as follows:
Jetty, Windows 8
solrconfig.xml (nothing changed except for the following)
[...]
<lib dir="../../../../dist/" regex="solr-dataimporthandler-.*\.jar" />
<lib dir="../../../../dist/" regex="sqljdbc4.*\.jar" />
<lib dir="../../../../dist/" regex="postgresql-.*\.jar" />
[...]
data-config.xml
<dataConfig>
<dataSource type="JdbcDataSource"
driver="org.postgresql.Driver"
url="jdbc:postgresql://localhost:5432/solrdih"
user="solrdih"
password="solrdih"
batchSize="100" />
<document>
<entity name="solrdih"
query="SELECT * FROM myTable">
<field column="id" name="id" />
</entity>
</document>
</dataConfig>
schema.xml (nothing changed except for the following)
[...]
<fields>
<field name="id" type="string" indexed="true" stored="true" required="true" multiValued="false" />
<field name="name" type="text" indexed="true" stored="true"/>
<field name="description" type="text" indexed="true" stored="true"/>
[...]
Calling http://localhost:8983/solr/solr/dataimport, I get the following:
It reads:
ERROR DocBuilder Exception while processing: solrdih document : SolrInputDocument[]:org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT * FROM myTable Processing Document # 1
ERROR DataImporter Full Import failed:java.lang.RuntimeException: java.lang.RuntimeException: org.apache.solr.handler.dataimport.DataImportHandlerException: Unable to execute query: SELECT * FROM myTable Processing Document # 1
Could someone please provide hints where to look for the error?
Thanks in advance!
So, this error came from all the way down in Postgres and everything works fine since I made changes to pg_hba.conf
host all all 127.0.0.1/32 md5
to
host all all 127.0.0.1/32 trust

Custom Report using Business Intelligence Development Studio FetchXML

I want to create a custom report which will display all associated Products of all/any Order. That means in Order page its showing all Orders and associated Products, and in any Order record page it should display only the Products associated with that Order.
Previously I did that using report wizard.It was working as I wanted.
But I am not able to do it in Business Intelligence Development Studio.
this is the FetchXML
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="salesorderdetail">
<attribute name="productid" />
<attribute name="productdescription" />
<attribute name="priceperunit" />
<attribute name="quantity" />
<attribute name="extendedamount" />
<attribute name="salesorderdetailid" />
<order attribute="productid" descending="false" />
<link-entity name="salesorder" from="salesorderid" to="salesorderid" alias="ad">
<filter type="and">
<condition attribute="salesorderid" operator="eq">
</condition>
</filter>
</link-entity>
</entity>
</fetch>
How I can modify this XML so that it will work like above?
Finally, I am able to do it, using sub query.
This it the Sub query fetchXML:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="salesorderdetail">
<attribute name="productid" />
<attribute name="productdescription" />
<attribute name="priceperunit" />
<attribute name="quantity" />
<attribute name="extendedamount" />
<attribute name="salesorderdetailid" />
<order attribute="productid" descending="false" />
<link-entity name="salesorder" from="salesorderid" to="salesorderid" alias="af">
<filter type="and">
<condition attribute="salesorderid" operator="eq" uitype="salesorder" value="#salesorderid"/>
</filter>
</link-entity>
</entity>
</fetch>
and this is the fetchXML of the main query:
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="salesorder" enableprefiltering="1">
<attribute name="name" />
<attribute name="salesorderid" />
<order attribute="name" descending="false" />
<filter type="and">
<condition attribute="ownerid" operator="eq-userid" />
<condition attribute="statecode" operator="in">
<value>0</value>
<value>1</value>
</condition>
</filter>
</entity>
</fetch>
Hope this will help someone.