How to get a record deleted from Endeca Index using Record Manipulator - endeca

I have a test case in endeca in which I have to drop record if a particular word is present in one Url attribute of a record.
E.g: URL: www.abc.com/tree/temp/circle/hello/....
I need to check if word "temp" is present in url attribute then that record should be dropped from getting indexed. I am using below code in Record Manipulator but seems some issue because of which it is not working
<EXPRESSION LABEL="" NAME="REMOVE" TYPE="VOID" URL="">
<EXPRESSION LABEL="" NAME="IF" TYPE="VOID" URL="">
<EXPRESSION LABEL="" NAME="MATH" TYPE="INTEGER" URL="">
<EXPRNODE NAME="TYPE" VALUE="STRING"/>
<EXPRNODE NAME="OPERATOR" VALUE="CMP_SUBSTR"/>
<EXPRESSION LABEL="" NAME="IDENTITY" TYPE="PROPERTY" URL="">
<EXPRNODE NAME="PROP_NAME" VALUE="URL"/>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL="">
<EXPRNODE NAME="VALUE" VALUE="temp"/>
</EXPRESSION>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="REMOVE_RECORD" TYPE="VOID" URL=""/>
</EXPRESSION>
</EXPRESSION>
</EXPRESSION>
Record is still showing up in index. Help me to understand where I am getting this wrong. Why it is not working?

If you decide to write a CAS Java based manipulator you can do it pretty easily. There are examples available if you install them during the CAS install phase.
In the example the records are output via mOutputChannel.output(record).
You can easily set a boolean in the delete case and then that records is passed over by the output phase of the manipulator.
if (output_record)
{
mOutputChannel.output(record);
}

Related

Why am I receiving an uncaught type error from my KendoUI taghelper grid in my ASP.NET Core application?

I have a tag helper KendoUI grid, the grid is filterable but when I added the filter properties I get an error message back of:
Uncaught TypeError: t is undefined kendo.all.js:96768:38
If I remove the line of code that sets the grid as filterable it works but there is no filtering capability.
<filterable enabled="true" mode="row" />
Looking at this closely, removing the property of mode=¬row" causes the error to go away however, as above there are no filter capabilities.
Here is the complete code for my grid as it stands:
<kendo-grid name="addVesselPositionGrid" deferred="false">
<datasource type="DataSourceTagHelperType.Ajax" page-size="10">
<transport>
<read url="/Core/ReadVessels" />
</transport>
<schema>
<model id="Id">
<fields>
<field name="Id" editable="false"></field>
<field name="Name" type="Name" />
<field name="IMO" type="IMO" />
</fields>
</model>
</schema>
</datasource>
<sortable enabled="true" />
<pageable enabled="true" />
<filterable enabled="true" mode="row" />
<columns>
<column field="Id" title="Id" hidden="true"></column>
<column field="Name" title="Name">
<filterable multi="true">
<cell operator="Contains" suggestion-operator="Contains"></cell>
</filterable>
</column>
<column field="IMO" title="IMO"></column>
</columns>
</kendo-grid>
I've searched the documentation but I can't find any information on this, looking at my code it seems to be accurate. Any ideas?

How to load and process text data on upper-levels of a dimension in icCube?

I want to load textual data on any member in a natural hierarchy in icCube, but I am not able to display the textual values with MDX for the upper-levels.
Consider the following (natural) hierarchy, data and expected outcome:
(It might look a bit weird, but icCube allows to have the leaf empty for SUB013 and SUB014.)
As you can see in the desired outcome in the picture above, I expect "voila" to be displayed on SUB015.
But, I can not get it to work. See the outcome I get with MDX:
I have the following issues:
the value is empty (I have used the no aggregation type on text)
another observation is that also the amount is empty for a no aggregation type
Is this solvable, somehow?
(enclosed as a snippet - not runnable - the schema I used, which you can upload in your instance of icCube)
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<schemaFactory revisionNumber="77">
<schemaDefinition name="text on sub-total" description="" group="Research" loadOnStartup="false">
<activateIncrementalLoad>false</activateIncrementalLoad>
<useUnknownMembersInFacts>false</useUnknownMembersInFacts>
<autoCleanUpTableColumns>false</autoCleanUpTableColumns>
<useFactPartitioning>false</useFactPartitioning>
<callGarbageCollector>NONE</callGarbageCollector>
<backup>NONE</backup>
<nonEmptyCachePolicy>NONE</nonEmptyCachePolicy>
<nonEmptyCacheType>REGULAR</nonEmptyCacheType>
<nonEmptyCachePersistency>MEMORY</nonEmptyCachePersistency>
<storagePolicy>DEFAULT</storagePolicy>
<hierarchyUniqueNameStyle>IncludeDimensionName</hierarchyUniqueNameStyle>
<inMemoryDS name="manual">
<memoryDataTable tableName="data" rowLimit="-1" id="3c476e37-708d-4066-831c-89508134beb7">
<column name="dim" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="costs" tableType="STRING" type="DOUBLE" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="text" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>\t</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>dim costs text
CHILD001
CHILD002
CHILD003 10 hi
CHILD004
CHILD005
SUB013 59 salut
SUB014 69 bonjour
SUB015 180 voila
</dataAsString>
</memoryDataTable>
<memoryDataTable tableName="dim" rowLimit="-1" id="373a4b14-5b7d-441d-91c0-caabeb670936">
<column name="SubTotal" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<column name="Leaf" tableType="STRING" type="STRING" selected="true" primaryKey="false" nullObjectAsString=""/>
<addRowNumber>false</addRowNumber>
<stringDateConverter></stringDateConverter>
<trimStrings>true</trimStrings>
<columnSeparator>\t</columnSeparator>
<commentMarker>#</commentMarker>
<dataAsString>SubTotal Leaf
SUB013
SUB014
SUB015 CHILD001
SUB015 CHILD002
SUB015 CHILD003
SUB015 CHILD004
SUB015 CHILD005
</dataAsString>
</memoryDataTable>
</inMemoryDS>
<multiLevelDimension dataTableId="373a4b14-5b7d-441d-91c0-caabeb670936" isTimeDimension="false" isDefaultTimeDimension="false" isIndexingByRange="false" unknownMemberName="" id="6b08783b-b33c-4499-b253-212753be23fd" name="Dim">
<multiLevelHierarchy hasAllLevel="true" allLevelName="All-L" allMemberName="All-M" name="Dim" isDefault="true" defaultMemberName="">
<factAggregationType>MEMBER_AND_ANCESTORS</factAggregationType>
<level name="subtotal" nameUnique="true" nameUniqueInParent="false" keyUnique="true" ignoreNameCollision="false">
<column name="SubTotal"/>
<nameCol name="SubTotal"/>
<orderType>NONE</orderType>
<orderKind>ASC</orderKind>
</level>
<level name="leaf" nameUnique="true" nameUniqueInParent="false" keyUnique="true" ignoreNameCollision="false">
<column name="Leaf"/>
<nameCol name="Leaf"/>
<orderType>NONE</orderType>
<orderKind>ASC</orderKind>
</level>
</multiLevelHierarchy>
</multiLevelDimension>
<cube id="1c361ef2-ebba-475f-9cc8-83910e4530e2" name="data" description="">
<defaultFacts measureGroupName="Facts" partitioningLevelName="" partitioningType="NONE" newGeneration="true" dataTableId="3c476e37-708d-4066-831c-89508134beb7" aggregateDataSourceFacts="false" unresolvedRowsBehavior="ERROR">
<rowFactAggregationType>ADD_ROW</rowFactAggregationType>
<measure name="costs sum" aggregationType="SUM">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="costs"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="costs max" aggregationType="MAX">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="costs"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="costs no agg" aggregationType="NONE">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="costs"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="text max" aggregationType="MAX">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="text"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<measure name="text no agg" aggregationType="NONE">
<rollupHierarchy></rollupHierarchy>
<dataColumn name="text"/>
<cellProperties></cellProperties>
<emptyIsZero>false</emptyIsZero>
</measure>
<links dimensionId="6b08783b-b33c-4499-b253-212753be23fd">
<viewLinks type="ALL_LEVELS">
<toColumns name="dim"/>
</viewLinks>
</links>
</defaultFacts>
</cube>
<localization enabled="false"/>
<script>
<content>
</content>
</script>
</schemaDefinition>
</schemaFactory>
In icCube a node value, even if leaf, can be the result of an aggregation over multiple facts rows. When you specify, NO_AGGREGATION, as aggregation method the NULL is returned if more than one single row is in play.
For you example as SUB015 has a child with value, CHILD003. And the dimension is defined with 'Fact Aggr. Type' as 'Members and Ancestors'.
Two solutions :
1) Add a Dimension member property that is retrieved using a calculated member.
2) Use a dimension with 'Fact Aggr. Type' as 'Members' but you will get wrong cost.

not able to delete records using endeca partial update

I developed a partial pipeline and executed . There is no error that is generated.But record add and delete is not working, though record update is working fine.
Following is my record manipulator code (jobId is record spec) :
<EXPRESSION LABEL="" NAME="IF" TYPE="VOID" URL="">
<EXPRESSION LABEL="" NAME="MATH" TYPE="INTEGER" URL="">
<EXPRNODE NAME="TYPE" VALUE="STRING"/>
<EXPRNODE NAME="OPERATOR" VALUE="EQUAL"/>
<EXPRESSION LABEL="" NAME="IDENTITY" TYPE="PROPERTY" URL="">
<EXPRNODE NAME="PROP_NAME" VALUE="Endeca.Action"/>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL="">
<EXPRNODE NAME="VALUE" VALUE="UPSERT"/>
</EXPRESSION>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="UPDATE_RECORD" TYPE="VOID" URL="">
<EXPRNODE NAME="ACTION" VALUE="ADD_OR_REPLACE"/>
</EXPRESSION>
<EXPRNODE NAME="ELSE_IF" VALUE=""/>
<EXPRESSION LABEL="" NAME="MATH" TYPE="INTEGER" URL="">
<EXPRNODE NAME="TYPE" VALUE="STRING"/>
<EXPRNODE NAME="OPERATOR" VALUE="EQUAL"/>
<EXPRESSION LABEL="" NAME="IDENTITY" TYPE="PROPERTY" URL="">
<EXPRNODE NAME="PROP_NAME" VALUE="Endeca.Action"/>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="CONST" TYPE="STRING" URL="">
<EXPRNODE NAME="VALUE" VALUE="DELETE"/>
</EXPRESSION>
</EXPRESSION>
<EXPRESSION LABEL="" NAME="UPDATE_RECORD" TYPE="VOID" URL="">
<EXPRNODE NAME="ACTION" VALUE="DELETE_OR_IGNORE"/>
</EXPRESSION>
</EXPRESSION>
After I run partial udpate after deleting a record , get following at /data/partials/forge_output/TestAppen-sgmt0.records.xml_2014.03.26.09.33.53
<UPDATE>
<UPD_UNIT>
<RECORD_DELETE_OR_IGNORE/>
</UPD_UNIT>
</UPDATE>
But record doesnt get deleted.
Thanks,
Mayank Batra

Extract multiple date strings from a single varchar(MAX) column SQL Server

I've inherited a report spec subsystem that needs to be tweaked. The mission is to add a date column to the tReports table, and populate it with the CreateDate that is (supposed to be) contained in the XML Code Spec. The problem is that some of the older reports don't have the CREATEDATE attribute, or as in one example below, the XML is valid but poorly formed, and the CREATEDATE cannot be retrieved using the xQuery that works for most of the other reports. Since I don't have an explicit creation date included in the spec, I'm using interpolation to estimate a reasonable date. One factor of the interpolation is to look at the date strings contained in the report spec--some will be useful, others not.
There are too many reports (over 1,200) to visually skim each report spec for date strings. These date strings can appear in any location in the report spec, and there are a very large number of combinations of elements and attributes that can contain a date string.
The ideal solution would be a listing of the reportID's and the date string ready to use in an UPDATE, but because date format varies (m/d/yy, mm/dd/yy, m/dd/yy ...) I'd be grateful to get a vew spurious characters surrounding the date string that I could clean up later.
All the date strings will be from 2000 or later, so the search string I'v been using is '/20' which has provided good results.
I've looked at many sites that discuss this kind of issue, and found only one solution by Mikael Eriksson that is something like what I'm describing, but I can't make it work after several hours of playing with it. How to extract multiple strings from single rows in SQL Server
Is there a way, without using a cursor nor WHILE loop, to extract these embedded dates?
-- Some representative data: (I'm using SQL Server 2008 R2)
CREATE TABLE #ReportSpecs (ReportID INT, ReportSpec VARCHAR(MAX))
INSERT INTO #ReportSpecs
( ReportID, ReportSpec )
VALUES
(136,
'<ReportID>136</ReportID>
<EmpIDCreator>23816</EmpIDCreator>
<EmpName>Blanc, Melvin J</EmpName>
<ReportType>0</ReportType>
<ReportName>PSST Sys Spec</ReportName>
<ReportData>
<REPORT>
<COLUMNS>
<Column Name="JobNumber" Position="1" />
<Column Name="TaskType" Position="2" />
<Column Name="Assignees" Position="3" />
<Column NAME="JobDueDate" Position="4" />
<Column Name="ReferenceNumber" Position="5" />
<Column Name="Deliverable" Position="6" />
<Column Name="Priority" Position="7" />
</COLUMNS>
<FILTERS>
<FILTER NAME="TYPE" VALUE="To_Me" />
<FILTER NAME="Status" VALUE="All" />
<FILTER NAME="DateOptions" VALUE="DateRange" From="8/16/2002" To="8/23/2002" />
<FILTER NAME="FromDate" VALUE="8/16/2002" />
<FILTER NAME="ToDate" VALUE="8/23/2002" />
<FILTER NAME="Role" VALUE="All" />
</FILTERS>
<parameters>
<PARAMETER NAME="#Cascading" TYPE="integer" VALUE="0" />
<PARAMETER NAME="#EmpID" SYSTEM="true" TYPE="integer" VALUE="#Request.EmployeeIDAlias#" />
<PARAMETER NAME="#FromOrgs" TYPE="varchar(250)" VALUE="" />
<PARAMETER NAME="#ToOrgs" TYPE="varchar(250)" VALUE="" />
</parameters>
<NAME>PSST Sys Spec</NAME>
<OWNER>
<ID>23816</ID>
</OWNER>
<source id="8" useinternalid="True" />
</REPORT>
</ReportData>'),
(311,
'<ReportID>311</ReportID>
<EmpIDCreator>7162</EmpIDCreator>
<EmpName>Potter, Harry J</EmpName>
<ReportType>0</ReportType>
<ReportName>CPVC Synch Test</ReportName>
<ReportData>
<REPORT>
<COLUMNS>
<Column Name="JobNumber" Position="1" />
<Column Name="TaskType" Position="2" />
<Column Name="Subject" Position="3" />
<Column Name="CurrentAssignee" Position="4" />
<Column NAME="JobDueDate" Position="5" />
<Column Name="Deliverable" Position="6" />
<Column Name="Category" Position="7" />
<Column Name="Priority" Position="8" />
</COLUMNS>
<FILTERS>
<FILTER NAME="TYPE" VALUE="By_Orgs_6098,By_Orgs_6123" />
<FILTER NAME="Status" VALUE="Open" />
<FILTER NAME="DateOptions" VALUE="DateRange" From="3/25/2002" To="4/4/2002" />
<FILTER NAME="ReviewFromDate" VALUE="3/25/2002" />
<FILTER NAME="ReviewToDate" VALUE="4/4/2002" />
<FILTER NAME="Role" VALUE="All" />
</FILTERS>
<parameters>
<PARAMETER NAME="#Act" TYPE="integer" VALUE="0" />
<PARAMETER NAME="#MgrID" SYSTEM="true" TYPE="integer" VALUE="#Request.EmployeeIDAlias#" />
<PARAMETER NAME="#MgrIDActing" TYPE="integer" VALUE="" />
<PARAMETER NAME="#FromDept" TYPE="varchar(250)" VALUE="" />
<PARAMETER NAME="#FromEmp" TYPE="varchar(250)" VALUE="" />
<PARAMETER NAME="#ToDept" TYPE="varchar(250)" VALUE="" />
</parameters>
<NAME>CPVC Synch Test</NAME>
<OWNER>
<ID>7162</ID>
</OWNER>
<source id="17" useinternalid="True" />
</REPORT>
</ReportData>'),
(1131,
'<ReportID>1131</ReportID>
<EmpIDCreator>13185</EmpIDCreator>
<EmpName>Reed, Alan</EmpName>
<ReportType>0</ReportType>
<ReportName>
''"><script>alert(''hello'')</script>
</ReportName>
<ReportData>
<Report NAME="''">
<script>alert(''hello'')</script>" CREATEDATE="12/7/2009">
<DESCRIPTION>sfasf</DESCRIPTION>
<OWNER ID="13185"/>
<SOURCE ID="1" USEINTERNALID="TRUE"/>
<COLUMNS>
<COLUMN NAME="JobNumber" POSITION="1" SORTORDER="asc"/>
</COLUMNS>
<FILTERS>
<FILTER NAME="TYPE" VALUE="By_Me,To_Me" />
<FILTER NAME="ASGSTATUS" VALUE="Open" />
<FILTER NAME="DATEOPTIONS" VALUE="All" />
<FILTER NAME="STATUS" VALUE="Open" />
<FILTER NAME="ASGDATEOPTIONS" VALUE="All" />
<FILTER NAME="ROLE" VALUE="All" />
</FILTERS>
<PARAMETERS>
<PARAMETER NAME="#Me" TYPE="integer" VALUE="3" />
<PARAMETER NAME="#FromCost" TYPE="varchar(250)" VALUE=""/>
<PARAMETER NAME="#ToCost" TYPE="varchar(250)" VALUE="" />
</PARAMETERS>
<ADVANCEDSORT SortByA="JobNumber" SortOrderA="asc" SortByB="" SortOrderB="" SortByC="" SortOrderC="" />
</Report>
</ReportData>');
/*
Desired Output (A DISTINCT list would be better, but just getting this output would be GREAT.)
ReportID DateString
-------- ----------
136 8/16/2002
136 8/23/2002
136 8/16/2002
136 8/23/2002
311 3/25/2002
311 4/4/2002
311 3/25/2002
311 4/4/2002
1131 12/7/2009
*/
DROP TABLE #ReportSpecs
Thanks for your time.
select R.ReportID,
D.V as DateString
from #ReportSpecs as R
cross apply (select cast(R.ReportSpec as xml)) as X(R)
cross apply X.R.nodes('//#*, //*/text()') as T(X)
cross apply (select T.X.value('.', 'varchar(max)')) as D(V)
where charindex('/20', D.V) > 0
Result:
ReportID DateString
----------- --------------------------
136 8/16/2002
136 8/23/2002
136 8/16/2002
136 8/23/2002
311 3/25/2002
311 4/4/2002
311 3/25/2002
311 4/4/2002
1131 " CREATEDATE="12/7/2009">

Using the Propel ORM, how would one delete all related records of an object?

I have a pretty simple Propel question. I'm storing leads in a database. Those leads have one or more community interests. The tables I'm using are named, 'lead', 'community', and a 'lead_communities' join table. What's the best way to delete all of a lead's community interests?
Here are some more details. The Propel schema looks like this:
<table name="community">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true" />
<column name="name" type="VARCHAR" size="255" />
<column name="address" type="VARCHAR" size="255" />
etc...
<table name="lead_communities">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true"/>
<column name="lead_id" type="INTEGER" />
<column name="community_id" type="INTEGER" />
<column name="created_date" type="DATE" size="4" />
<foreign-key foreignTable="community" refPhpName="Lead_Communities">
<reference local="community_id" foreign="id"/>
</foreign-key>
<foreign-key foreignTable="lead" refPhpName="Lead_Communities">
<reference local="lead_id" foreign="id"/>
</foreign-key>
</table>
<table name="lead">
<column name="id" type="INTEGER" required="true" primaryKey="true" autoIncrement="true"/>
<column name="salutation" type="VARCHAR" size="20" />
<column name="first_name" type="VARCHAR" size="255" defaultValue="" />
<column name="last_name" type="VARCHAR" size="255" defaultValue="" />
<column name="email" type="VARCHAR" size="255" defaultValue="" />
etc..
Here's how I select the lead from the database:
$lead = LeadQuery::create()->filterByEmail($enauk)->findOne();
So, what I hope to do is something like:
$lead->deleteLeadCommunities();
Well, the easiest way I can think of without any other context is simply doing a query on the join table with a delete() call:
$numDeleted = LeadCommunitiesQuery::create()
->filterByLead($lead)
->delete();
Just to be clear, there is no generated method like what you want (deleteLeadCommunities), but you could always write it for convenience, and replace $lead in my example code with $this. So inside Lead.php:
public function deleteLeadCommunities() {
return LeadCommunitiesQuery::create()
->filterByLead($this)
->delete();
}