Filter ArrayCollection by index
What is the syntax to reference the index in an ArrayCollection? I know if you remove any filterFunction from an ArrayCollection it will be automatically ordered by index, but I want to explicitly refer to the index in a filterFunction:
private function filterUsingIndexNum(item:Object):Boolean{
if(item.index < someValue) return true;
else return false;
// item.index is not referencing a property of the data in the ArrayCollection, I am actually trying to reference the index numder of the items in the ArrayCollection.
Thanks.
I just figured out the solution; actually, the correct syntax:
private function filterUsingIndexNum(item:Object):Boolean{
if(theArraCollection.getItemIndex(item) < someValue) return true;
else return false;
Similar Messages
-
Strange behavior when using servlet filter with simple index.htm
I am new to J2EE development so please tolerate my ignorance. I have a web application that starts with a simple index.htm file. I am using a servlet filter throughout the website to check for session timeout, redirecting the user to a session expiration page if the session has timed out. When I do something as simple as loading the index.htm page in the browser, the .css file and one image file that are associated, or referenced in the file are somehow corrupted and not being rendered. How do I get the filter to ignore css and image files??? Thank you!!
The servlet filter:
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class SessionTimeoutFilter implements Filter {
String[] excludedPages = {"SessionExpired.jsp","index.htm","index.jsp"};
String timeoutPage = "SessionExpired.jsp";
public void destroy() {
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if ((request instanceof HttpServletRequest) && (response instanceof HttpServletResponse)) {
HttpServletRequest httpServletRequest = (HttpServletRequest) request;
HttpServletResponse httpServletResponse = (HttpServletResponse) response;
//httpServletResponse.setHeader("Cache-Control","no-cache");
//httpServletResponse.setHeader("Pragma","no-cache");
//httpServletResponse.setDateHeader ("Expires", 0);
String requestPath = httpServletRequest.getRequestURI();
boolean sessionInvalid = httpServletRequest.getSession().getAttribute("loginFlag") != "loggedIn";
System.out.println(sessionInvalid);
boolean requestExcluded = false;
System.out.println(requestExcluded);
for (int i=0;i<excludedPages.length;i++){
if(requestPath.contains(excludedPages)){
requestExcluded = true;
if (sessionInvalid && !requestExcluded){
System.out.println("redirecting");
httpServletResponse.sendRedirect(timeoutPage);
// pass the request along the filter chain
chain.doFilter(request, response);
public void init(FilterConfig arg0) throws ServletException {
//System.out.println(arg0.getInitParameter("test-param"));
The index.htm file (or the relevant portion)<HTML>
<Head>
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="RTEStyleSheet.css" rel="stylesheet" type="text/css">
<TITLE>Login</TITLE>
</HEAD>
<BODY>
<FORM NAME="Login" METHOD="POST" ACTION="rte.ServletLDAP"><!-- Branding information -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="30%" align="left"><img src="images/top_logo_new2.gif">
</td>
<td width="37%" align="center"></td>
<td width="33%" align="right"></td>
</tr>
</table>
My web.xml entry for the filter: <filter>
<description>
Checks for a session timeout on each user request, redirects to logout if the session has expired.</description>
<display-name>
SessionTimeoutFilter</display-name>
<filter-name>SessionTimeoutFilter</filter-name>
<filter-class>SessionTimeoutFilter</filter-class>
<init-param>
<param-name>test-param</param-name>
<param-value>this is a test parameter</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>SessionTimeoutFilter</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
<dispatcher>FORWARD</dispatcher>
</filter-mapping>Hi,
Try adding CSS files and images to the excluded Pages. -
Is it possible to search ArrayCollection by index?
Hi all,
As I know, we can loop and compare each item of ArrayCollection to get correct item we want. Obveriously, the performance will get bad and it's not a wise method to search. Can we create a index for the key field of each item? Or is there any other class providing such functionality?
Thanks,When you say "an index" are you talking as a in a database table index? I.e. something that can quicken a search?
I am trying to understand your desire and I think what I am hearing is that you have an ArrayCollection contain a number of Objects. When you want to find a particular Object, you have found that one way to locate the desired instance is to walk through each element of the ArrayCollection and ask "does this element equal the key of the object I am looking for?". I think you are concerned by the amount of time that this may take.
Going back decades to my computing science knowledge, this would be an O(n) algorithm where n is the number of elements in the array.
Now, if there were an "index" (ala databases) on the data, then if this index were Sorted, you would be able to find your match in O(log n)
You may pay an O(n log n) cost to sort the index when the data structure is created but if you have a large number of searches then it may pay for itself.
I am not aware of any function that will support you on this out of the box (but that doesn't mean there isn't, only that I don't know about it.
I would also truthly ask yourself "is it worth the cost?". How many elements will you have in a typical array? How often do you anticipate locating an entry in that array?
Neil -
Default Filter Criteria - "Current (Indexed)" Column?
Hello Technet,
When you create a "Standard View" in SharePoint online, if you look under the Filter section, a default filter is automatically added on the "Current (Indexed)" column, causing the list to show only list items that have Current = Yes.
My question is in two parts;
What does this Current (Indexed) column mean/do?
Why, as my list approached 2500 items, are many of the newly created list items not showing in views that have this criteria?
I am unable to find that column when I modify the list so I assume it has something to do with SharePoint's automatic version control. I'm not getting why all of a sudden this would not be working? One thought, I do know that SharePoint lists
are limited to a 5,000 item limit, is it possible the "versions" list, if that exists on the back-end, has gotten too large and is no longer saving items?As there is no default view with a filter already enabled OOTB I would suggest you to create a service ticket at O365 support or via MS Premier Support.
Michiel Hamers www.SharePointman.nl Don't hesitate to contact me for a SharePoint/O365 question. -
Under Connections, I choose my database, then the user, and from there I view my Tables. I have no need to view Views, Indexes, Packages, Procedures, etc., just the tables (which I am able to filter).
Since the tree containing Views, Indexes, Packages, etc., take up a lot of real estate (I work with multiple databases, each with a specific user, or schema), is it not possible to filter these out?
Thanks!
Edited by: user9956988 on Jun 15, 2010 3:53 PMJust to double check that I'm interpreting the problem correctly, is the following true:
select * from all_objects where object_name = 'DBA_SOURCE'
returns nothing
select * from dba_source where name = your PL/SQL module
returns all the code -
Exclude/Filter Filename from Index (Indexing SAP Offline Help)
Hi All,
I managed it to index the SAP Documentation DVD (aka SAP Library, aka SAP Help).
Ok, now I can search for keywords. Now TREX searched all files; also the "frameset.htm" files.
Basically only the "content.htm" files are important to the users... since frameset files dont't deliver any content "No document excerpt available".
I think now you understand my issue: Is it possible only to index the "content.htm" files and to exclude/filter the "frameset.htm" files?
Thanks in advance for any detailed hints and how-to's...
PhilippHi Philipp,
Within your index, you have defined some (probable: standard) crawler. You can copy the standard crawler, use this copy instead, and activate some resource filter on it, scope filtering using URL Regular Expression.
See http://help.sap.com/saphelp_nw2004s/helpdata/en/46/5d5040b48a6913e10000000a1550b0/frameset.htm for details.
Hope it helps
Detlev -
Indexed short text on a filter
Hi guys,
I created a prompt to filter the field "Indexed short text 1" on a dashboard. I've already create the filter "indexed short text is prompt" on the detailed report. However I got nothing even If I paste the exactly text of this field on my prompt.
Is it possible to filter a short txt on dashboards on the CRM OD?
Thanks in advance
RafaelYou can absolutely use an indexed short text field as filter prompt. Make sure that you are building the prompt and the report from the same subject area and double-check your fields and prompt settings. You may want to start over with a very simple prompt + report to help troubleshoot.
-
Hi There,
I'm trying to add an index using a KeyExtractor which is use in a filter. It appears to be complaining that there is no method on the entry. A filter using the and EqualsFilter(KeyExtractor()) works fine. I'm guessing it's complaining because it's not going to the key but the entry. I can get over this by duplicating the object from the key into the object but it just seems a shame.
2008-04-17 11:53:34.137 Oracle Coherence GE 3.3/387p6 <Error> (thread=DistributedCache, member=1): Exception occured during index rebuild: java.lang.RuntimeException: Missing or inaccessible method: com.rbos.risk.domain.portfoliomanager.PortfolioKey#getPortfolioKey[]I do, although I've just rationalised that into a static final and use both for the filter and the index, and it now seems to work.
It must've been some mismatch in what I thought was going on, sorry to have troubled you :) -
Looping through an array to get the index for each measure in a combo box
Hi folks,
I am working on a web application that has two combo boxes, one for year (called yearcombo) and for measures (called myURL) for that selected year, and also two radiobuttons (in radioBtnGroup). I have two years and a bunch of measure for each year. I have a map tool tip that when you mouse over the county you see a measure for that specific year. However I have a bunch of measures for each year and I want to be able to loop through the measures (which are in an array collection inside a combobox) so my "if" expression can find every selectedIndex and bring me the tool tip for that selected measure for that selected radio button. Right now I would have to create if statements for each measure (each selectedIndex inside the myURL combobox)and each radiobutton (inside the radioBtnGroup) instead of creating a if expression to get a map tip tool for each measure. I know I would have to create a loop to search for these indexes and enter that in the if expression and also change the graphic.attributes to reflect the right measure or index selected. Do you API for Flex wizards can give me any tips on how to code this according to my code below ? Any help is greatly appreciated! (the print scree is attached)
Below is the code snippet:
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
And below is the combo boxes with the arrays
<mx:FormItem label="Year :" >
<mx:ComboBox id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)" >
<mx:ArrayCollection id="year" >
<fx:Object label="2007" year="2007" />
<fx:Object label="2009" year="2009" />
</mx:ArrayCollection>
</mx:ComboBox>
</mx:FormItem>
<mx:FormItem label="Measure:">
<mx:ComboBox id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
<mx:ArrayCollection id="measures" >
<fx:Object id="forindout07" labeltext="2007 Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007" />
<fx:Object id="foremp07" label="2007 Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
<fx:Object id="forlabinc07" label="2007 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
<fx:Object id="forindbustax07" label="2007 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
<fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009" />
<fx:Object id="foremp09" label="2009 Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
<fx:Object id="forlabinc09" label="2009 Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
<fx:Object id="forindbustax09" label="2009 Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
<fx:Object id="blank" label=" " />
</mx:ArrayCollection>And here is the entire code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:esri="http://www.esri.com/2008/ags"
paddingBottom="8" paddingLeft="8"
paddingRight="8" paddingTop="8"
backgroundColor="0xffffff"
layout="vertical" >
<!-- Start Declarations -->
<fx:Declarations>
<esri:SimpleFillSymbol id="mouseOverSymbol" alpha="0.5" color="0x808080">
<esri:SimpleLineSymbol width="0" color="#000000"/>
</esri:SimpleFillSymbol>
<esri:SimpleFillSymbol id="defaultsym" alpha="0.01" color="#E0E0E0" >
<esri:SimpleLineSymbol width="1" color="#000000"/>
</esri:SimpleFillSymbol>
<!-- End Declarations -->
</fx:Declarations>
<fx:Script>
<![CDATA[
import com.esri.ags.Graphic;
import com.esri.ags.SpatialReference;
import com.esri.ags.esri_internal;
import com.esri.ags.events.GraphicEvent;
import com.esri.ags.geometry.Extent;
import com.esri.ags.layers.ArcGISDynamicMapServiceLayer;
import com.esri.ags.symbols.SimpleFillSymbol;
import com.esri.ags.symbols.SimpleLineSymbol;
import flash.utils.flash_proxy;
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.controls.RadioButton;
import mx.controls.TextArea;
import mx.events.DropdownEvent;
import mx.events.ItemClickEvent;
import mx.rpc.Fault;
import mx.rpc.events.FaultEvent;
import flash.display.Sprite;
import flash.events.ErrorEvent;
import flash.events.MouseEvent;
private function closeHandler(evt:DropdownEvent):void {
myLabel.text = ComboBox(evt.target).selectedItem.labeltext;
private function loadLayerName():void
myLegend.layers = null;
layerPanel.removeAllChildren();
//loop through each layer and add as a radiobutton
for(var i:uint = 0; i < (dynamicLayer.layerInfos.length); i++)
var radioBtn:RadioButton = new RadioButton;
radioBtn.groupName = "radioBtnGroup";
radioBtn.value = i;
radioBtn.label = dynamicLayer.layerInfos[i].name;
if (dynamicLayer.layerInfos[i].name == "Direct Impact (Million $)")
radioBtn.label = "Direct Impact";
else if (dynamicLayer.layerInfos[i].name == "Total Impact (Million $)")
{radioBtn.label = "Total Impact";
else if (dynamicLayer.layerInfos[i].name == "Total Impact (Jobs)")
{radioBtn.label = "Total Impact";
else if (dynamicLayer.layerInfos[i].name == "Direct Impact (Jobs)")
{radioBtn.label = "Direct Impact";
else
{radioBtn.visible= false;
layerPanel.addChild(radioBtn);
/* myDividerBox.getDividerAt(0).visible = false; */
//set the visible layer the first radio button
radioBtnGroup.selectedValue = 0;
dynamicLayer.visibleLayers = new ArrayCollection([0]);
myLegend.layers = [dynamicLayer];
myLegend.visible = true;
private function radioClickHandler(event:ItemClickEvent):void
myLegend.layers = null;
// update the visible layers to only show the layer selected
dynamicLayer.visibleLayers = new ArrayCollection([event.index]);
myLegend.layers = [dynamicLayer];
private function changeEvt(event:Event):void {
if (yearcombo.selectedItem.year == "2007")
measures.filterFunction=filter1
measures.refresh()
myURL.dataProvider=measures
else if (yearcombo.selectedItem.year == "2009")
measures.filterFunction=filter2
measures.refresh();
public function filter1(item:Object):Boolean
if (item.year=="2007") return true
else return false
public function filter2(item:Object):Boolean
if (item.year=="2009") return true
else return false
private function clickEvt(event:Event):void {
if (yearcombo.selectedItem.year == "2007")
measures.filterFunction=filter3
measures.refresh()
myURL.dataProvider=measures
else if (yearcombo.selectedItem.year == "2009")
measures.filterFunction=filter4
measures.refresh();
public function filter3(item:Object):Boolean
if (item.year=="2007") return true
else return false
public function filter4(item:Object):Boolean
if (item.year=="2009") return true
else return false
private function clickEv2(event:Event):void {
if (yearcombo.selectedItem.year == "2007")
measures.filterFunction=filter5
measures.refresh()
else if (yearcombo.selectedItem.year == "2009")
measures.filterFunction=filter6
measures.refresh();
else if (yearcombo.selectedItem.year == 2007 && myURL.selectedIndex==8)
myLegend.layers = null;
layerPanel.removeAllChildren();
public function filter5(item:Object):Boolean
if (item.year=="2007") return true
else return false
public function filter6(item:Object):Boolean
if (item.year=="2009") return true
else return false
/* IF YOU WANT TO INCLUDE OTHER VALUES IN THE MAP TOOLTIP LIKE COUNTY NAME AND THE LABEL OF THE SELECTED ITEM
if (myURL.selectedIndex==0)
myTextArea.htmlText = "<b>County: </b>" + gr.attributes.NAME + "\n"
+ "<b>Measure: </b>" + myURL.selectedItem.label + gr.attributes.ForDirIndOut.toString()
public function fLayer_graphicAddHandler(event:GraphicEvent):void
event.graphic.addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
event.graphic.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);
public function onMouseOverHandler(event:MouseEvent):void
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2007" && myURL.selectedIndex == 3 )
fLayer.definitionExpression = "DATA_YEAR_TXT like '2007'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 0 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpIndOut.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 1 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpEmp.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 0)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForDirLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 2 && radioBtnGroup.selectedValue == 1)
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForTotImpLabInc.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
if (yearcombo.selectedItem.year == "2009" && myURL.selectedIndex == 3 )
fLayer.definitionExpression = "DATA_YEAR_TXT like '2009'"
var graphic:Graphic = Graphic(event.currentTarget);
graphic.symbol = mouseOverSymbol;
var htmlText:String = graphic.attributes.htmlText;
var textArea:TextArea = new TextArea();
try{
textArea.htmlText = myURL.selectedItem.label + graphic.attributes.ForIndirBusTax.toString()
myMap.infoWindow.content=textArea
myMap.infoWindow.label = graphic.attributes.NAME;
myMap.infoWindow.closeButtonVisible = false;
myMap.infoWindow.show(myMap.toMapFromStage(event.stageX, event.stageY));}
catch(error:Error) {
trace("Caught Error: "+error);
public function onMouseOutHandler(event:MouseEvent):void
var gr:Graphic = Graphic(event.target);
gr.symbol = defaultsym;
myMap.infoWindow.hide();
]]>
</fx:Script>
<fx:Style>
@namespace esri "http://www.esri.com/2008/ags";
@namespace s "library://ns.adobe.com/flex/spark";
@namespace mx "library://ns.adobe.com/flex/mx";
@namespace esri "http://www.esri.com/2008/ags";
@namespace components "com.esri.ags.components.*";
components|InfoWindow
content-background-alpha : 0.4;
background-color : #4A7138;
background-alpha : 0.7;
border-style : solid;
</fx:Style>
<mx:HBox width="930" height="800" id="mapHbox" horizontalAlign="center" >
<mx:HBox width="80">
</mx:HBox>
<mx:HBox id="myHBox" width="800" height="600" backgroundColor="0xffffff" >
<mx:VBox height="590" width="358" >
<!-- <mx:Panel
width="356" height="100%"
color="0x000000"
borderAlpha="0.15"
>
-->
<mx:Canvas height="100%" width="100%" backgroundColor="0xffffff" >
<esri:Map id="myMap" openHandCursorVisible="false"
height="100%"
logoVisible="false"
doubleClickZoomEnabled="false"
scrollWheelZoomEnabled="false"
zoomSliderVisible="false"
scaleBarVisible="false" scale="4000000" >
<esri:extent>
<esri:Extent xmin="-10736651.061900" ymin="4024099.909700" xmax="-10409195.669800" ymax="3440153.831100" >
<esri:SpatialReference wkid="102100"/>
</esri:Extent>
</esri:extent>
<esri:ArcGISDynamicMapServiceLayer id="dynamicLayer2"
url="http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/counties_layer/MapServer" />
<esri:ArcGISDynamicMapServiceLayer id="dynamicLayer" name=" "
alpha="1"
load="loadLayerName()"
url="http://tfs-24279/ArcGIS/rest/services/{myURL.selectedItem.value}/MapServer" />
<esri:FeatureLayer id="fLayer"
graphicAdd="fLayer_graphicAddHandler(event)"
mode="snapshot"
outFields="*"
symbol="{defaultsym}"
url= "http://tfs-24279/ArcGIS/rest/services/RADIO_BUTTONS/feature_layer_0709_five/FeatureServer/ 0" />
</esri:Map>
</mx:Canvas>
<!-- </mx:Panel>-->
</mx:VBox>
<mx:VBox height="590" width="20" >
</mx:VBox>
<mx:Canvas height="500" width="400" backgroundColor="0xffffff"
horizontalScrollPolicy="off"
verticalScrollPolicy="off" >
<mx:VBox width="420" height="50%" paddingLeft="5" paddingTop="10" paddingRight="10" paddingBottom="10"
verticalGap="8">
<mx:Form >
<mx:FormItem label="Year :" >
<mx:ComboBox id="yearcombo" selectedIndex="0" labelField="label" width="100%" change="changeEvt(event)" >
<mx:ArrayCollection id="year" >
<fx:Object label="2007" year="2007" />
<fx:Object label="2009" year="2009" />
</mx:ArrayCollection>
</mx:ComboBox>
</mx:FormItem>
<mx:FormItem label="Measure:">
<mx:ComboBox id="myURL" selectedIndex="8" width="80%" mouseOver="clickEv2(event)" close="closeHandler(event)">
<mx:ArrayCollection id="measures" >
<fx:Object id="forindout07" labeltext="Forestry Industry Output" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_07_forest_industry_output" year="2007" />
<fx:Object id="foremp07" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_07_forest_employment" year="2007" />
<fx:Object id="forlabinc07" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_07_forest_labincome" year="2007" />
<fx:Object id="forindbustax07" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_07_forest_business_tax" year="2007" />
<fx:Object id="forindout09" label="Forestry Industry Output " value="RADIO_BUTTONS/TFEI_09_forest_industry_output" year="2009" />
<fx:Object id="foremp09" label="Forestry Employment " value="RADIO_BUTTONS/TFEI_09_forest_employment" year="2009" />
<fx:Object id="forlabinc09" label="Forestry Labor Income " value="RADIO_BUTTONS/TFEI_09_forest_labincome" year="2009" />
<fx:Object id="forindbustax09" label="Forestry Indirect Business Tax" value="RADIO_BUTTONS/TFEI_09_forest_business_tax" year="2009" />
<fx:Object id="blank" label=" " />
</mx:ArrayCollection>
</mx:ComboBox>
</mx:FormItem>
</mx:Form>
<mx:VBox id="layerPanel" width="50%" height="8%" verticalGap="3" paddingLeft="17">
<mx:RadioButtonGroup id="radioBtnGroup" itemClick="radioClickHandler(event)" />
</mx:VBox>
<mx:VBox paddingLeft="17" height="50%" >
<mx:Canvas id="legendPanel" width="100%" >
<mx:Label id="myLabel" text=" " fontWeight="bold" />
<esri:Legend id="myLegend"
layers="{[dynamicLayer]}"
map="{myMap}" visible="false"
respectCurrentMapScale="false"/>
</mx:Canvas>
<mx:TextArea width="275" borderAlpha="0" height="200" >
<mx:htmlText >
<![CDATA[<font size='11'><b>Note:</b> Counties in white indicate either no data is available for that measure or the data has been supressed due to confidentiality.</font>
]]>
</mx:htmlText>
</mx:TextArea>
</mx:VBox>
</mx:VBox>
</mx:Canvas>
</mx:HBox>
</mx:HBox>
</mx:Application> -
Huge performance differences between a map listener for a key and filter
Hi all,
I wanted to test different kind of map listener available in Coherence 3.3.1 as I would like to use it as an event bus. The result was that I found huge performance differences between them. In my use case, I have data which are time stamped so the full key of the data is the key which identifies its type and the time stamp. Unfortunately, when I had my map listener to the cache, I only know the type id but not the time stamp, thus I cannot add a listener for a key but for a filter which will test the value of the type id. When I launch my test, I got terrible performance results then I tried a listener for a key which gave me much better results but in my case I cannot use it.
Here are my results with a Dual Core of 2.13 GHz
1) Map Listener for a Filter
a) No Index
Create (data always added, the key is composed by the type id and the time stamp)
Cache.put
Test 1: Total 42094 millis, Avg 1052, Total Tries 40, Cache Size 80000
Cache.putAll
Test 2: Total 43860 millis, Avg 1096, Total Tries 40, Cache Size 80000
Update (data added then updated, the key is only composed by the type id)
Cache.put
Test 3: Total 56390 millis, Avg 1409, Total Tries 40, Cache Size 2000
Cache.putAll
Test 4: Total 51734 millis, Avg 1293, Total Tries 40, Cache Size 2000
b) With Index
Cache.put
Test 5: Total 39594 millis, Avg 989, Total Tries 40, Cache Size 80000
Cache.putAll
Test 6: Total 43313 millis, Avg 1082, Total Tries 40, Cache Size 80000
Update
Cache.put
Test 7: Total 55390 millis, Avg 1384, Total Tries 40, Cache Size 2000
Cache.putAll
Test 8: Total 51328 millis, Avg 1283, Total Tries 40, Cache Size 2000
2) Map Listener for a Key
Update
Cache.put
Test 9: Total 3937 millis, Avg 98, Total Tries 40, Cache Size 2000
Cache.putAll
Test 10: Total 1078 millis, Avg 26, Total Tries 40, Cache Size 2000
Please help me to find what is wrong with my code because for now it is unusable.
Best Regards,
Nicolas
Here is my code
import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import com.tangosol.io.ExternalizableLite;
import com.tangosol.net.CacheFactory;
import com.tangosol.net.NamedCache;
import com.tangosol.util.Filter;
import com.tangosol.util.MapEvent;
import com.tangosol.util.MapListener;
import com.tangosol.util.extractor.ReflectionExtractor;
import com.tangosol.util.filter.EqualsFilter;
import com.tangosol.util.filter.MapEventFilter;
public class TestFilter {
* To run a specific test, just launch the program with one parameter which
* is the test index
public static void main(String[] args) {
if (args.length != 1) {
System.out.println("Usage : java TestFilter 1-10|all");
System.exit(1);
final String arg = args[0];
if (arg.endsWith("all")) {
for (int i = 1; i <= 10; i++) {
test(i);
} else {
final int testIndex = Integer.parseInt(args[0]);
if (testIndex < 1 || testIndex > 10) {
System.out.println("Usage : java TestFilter 1-10|all");
System.exit(1);
test(testIndex);
@SuppressWarnings("unchecked")
private static void test(int testIndex) {
final NamedCache cache = CacheFactory.getCache("test-cache");
final int totalObjects = 2000;
final int totalTries = 40;
if (testIndex >= 5 && testIndex <= 8) {
// Add index
cache.addIndex(new ReflectionExtractor("getKey"), false, null);
// Add listeners
for (int i = 0; i < totalObjects; i++) {
final MapListener listener = new SimpleMapListener();
if (testIndex < 9) {
// Listen to data with a given filter
final Filter filter = new EqualsFilter("getKey", i);
cache.addMapListener(listener, new MapEventFilter(filter), false);
} else {
// Listen to data with a given key
cache.addMapListener(listener, new TestObjectSimple(i), false);
// Load data
long time = System.currentTimeMillis();
for (int iTry = 0; iTry < totalTries; iTry++) {
final long currentTime = System.currentTimeMillis();
final Map<Object, Object> buffer = new HashMap<Object, Object>(totalObjects);
for (int i = 0; i < totalObjects; i++) {
final Object obj;
if (testIndex == 1 || testIndex == 2 || testIndex == 5 || testIndex == 6) {
// Create data with key with time stamp
obj = new TestObjectComplete(i, currentTime);
} else {
// Create data with key without time stamp
obj = new TestObjectSimple(i);
if ((testIndex & 1) == 1) {
// Load data directly into the cache
cache.put(obj, obj);
} else {
// Load data into a buffer first
buffer.put(obj, obj);
if (!buffer.isEmpty()) {
cache.putAll(buffer);
time = System.currentTimeMillis() - time;
System.out.println("Test " + testIndex + ": Total " + time + " millis, Avg " + (time / totalTries) + ", Total Tries " + totalTries + ", Cache Size " + cache.size());
cache.destroy();
public static class SimpleMapListener implements MapListener {
public void entryDeleted(MapEvent evt) {}
public void entryInserted(MapEvent evt) {}
public void entryUpdated(MapEvent evt) {}
public static class TestObjectComplete implements ExternalizableLite {
private static final long serialVersionUID = -400722070328560360L;
private int key;
private long time;
public TestObjectComplete() {}
public TestObjectComplete(int key, long time) {
this.key = key;
this.time = time;
public int getKey() {
return key;
public void readExternal(DataInput in) throws IOException {
this.key = in.readInt();
this.time = in.readLong();
public void writeExternal(DataOutput out) throws IOException {
out.writeInt(key);
out.writeLong(time);
public static class TestObjectSimple implements ExternalizableLite {
private static final long serialVersionUID = 6154040491849669837L;
private int key;
public TestObjectSimple() {}
public TestObjectSimple(int key) {
this.key = key;
public int getKey() {
return key;
public void readExternal(DataInput in) throws IOException {
this.key = in.readInt();
public void writeExternal(DataOutput out) throws IOException {
out.writeInt(key);
public int hashCode() {
return key;
public boolean equals(Object o) {
return o instanceof TestObjectSimple && key == ((TestObjectSimple) o).key;
}Here is my coherence config file
<?xml version="1.0"?>
<!DOCTYPE cache-config SYSTEM "cache-config.dtd">
<cache-config>
<caching-scheme-mapping>
<cache-mapping>
<cache-name>test-cache</cache-name>
<scheme-name>default-distributed</scheme-name>
</cache-mapping>
</caching-scheme-mapping>
<caching-schemes>
<distributed-scheme>
<scheme-name>default-distributed</scheme-name>
<backing-map-scheme>
<class-scheme>
<scheme-ref>default-backing-map</scheme-ref>
</class-scheme>
</backing-map-scheme>
</distributed-scheme>
<class-scheme>
<scheme-name>default-backing-map</scheme-name>
<class-name>com.tangosol.util.SafeHashMap</class-name>
</class-scheme>
</caching-schemes>
</cache-config>Message was edited by:
user620763Hi Robert,
Indeed, only the Filter.evaluate(Object obj)
method is invoked, but the object passed to it is a
MapEvent.<< In fact, I do not need to implement EntryFilter to
get a MapEvent, I could get the same result (in my
last message) by writting
cache.addMapListener(listener, filter,
true)instead of
cache.addMapListener(listener, new
MapEventFilter(filter) filter, true)
I believe, when the MapEventFilter delegates to your filter it always passes a value object to your filter (old or new), meaning a value will be deserialized.
If you instead used your own filter, you could avoid deserializing the value which usually is much larger, and go to only the key object. This would of course only be noticeable if you indeed used a much heavier cached value class.
The hashCode() and equals() does not matter on
the filter class<< I'm not so sure since I noticed that these methods
were implemented in the EqualsFilter class, that they
are called at runtime and that the performance
results are better when you add them
That interests me... In what circumstances did you see them invoked? On the storage node before sending an event, or upon registering a filtered listener?
If the second, then I guess the listeners are stored in a hash-based map of collections keyed by a filter, and indeed that might be relevant as in that case it will cause less passes on the filter for multiple listeners with an equalling filter.
DataOutput.writeInt(int) writes 4 bytes.
ExternalizableHelper.writeInt(DataOutput, int) writes
1-5 bytes (or 1-6?), with numbers with small absolute
values consuming less bytes.Similar differences exist
for the long type as well, but your stamp attribute
probably will be a large number...<< I tried it but in my use case, I got the same
results. I guess that it must be interesting, if I
serialiaze/deserialiaze many more objects.
Also, if Coherence serializes an
ExternalizableLite object, it writes out its
class-name (except if it is a Coherence XmlBean). If
you define your key as an XmlBean, and add your class
into the classname cache configuration in
ExternalizableHelper.xml, then instead of the
classname, only an int will be written. This way you
can spare a large percentage of bandwidth consumed by
transferring your key instance as it has only a small
number of attributes. For the value object, it might
or might not be so relevant, considering that it will
probably contain many more attributes. However, in
case of a lite event, the value is not transferred at
all.<< I tried it too and in my use case, I noticed that
we get objects nearly twice lighter than an
ExternalizableLite object but it's slower to get
them. But it is very intersting to keep in mind, if
we would like to reduce the network traffic.
Yes, these are minor differences at the moment.
As for the performance of XMLBean, it is a hack, but you might try overriding the readExternal/writeExternal method with your own usual ExternalizableLite implementation stuff. That way you get the advantages of the xmlbean classname cache, and avoid its reflection-based operation, at the cost of having to extend XMLBean.
Also, sooner or later the TCMP protocol and the distributed cache storages will also support using PortableObject as a transmission format, which enables using your own classname resolution and allow you to omit the classname from your objects. Unfortunately, I don't know when it will be implemented.
>
But finally, I guess that I found the best solution
for my specific use case which is to use a map
listener for a key which has no time stamp, but since
the time stamp is never null, I had just to check
properly the time stamp in the equals method.
I would still recommend to use a separate key class, use a custom filter which accesses only the key and not the value, and if possible register a lite listener instead of a heavy one. Try it with a much heavier cached value class where the differences are more pronounced.
Best regards,
Robert -
AUTO_FILTER in 10g results in NO indexes
I have a MULTI_COLUMN_DATASTORE associated with my index. One of the columns is a BLOB. I have tested with Word, XML and PPT documents and embedded text in those docs is searchable without me specifying any FILTER parameter during index creation.
When I test with PDF docs I don't find anything on my searches. I have tried INSO_FILTER and AUTO_FILTER during index creation and every time I get NO hits on any searches anymore. I rebuild my datastore with the new FILTER clause, specify Y for my BLOB column and N for the others. Again, I get NO hits for any searches. Rebuild datastore specifying N for the BLOB column and all indexes (except PDFs) get generated fine again.
I assume use of AUTO_FILTER requires something that I don't have configured.
Any ideas appreciated.Hi,
I am also planning to use Oracle text for our document and database searching (Oracle 10g (10.2.0)). I have saved 2 files (.DOC and .PDF) as blobs in the database. I used the following script for creating index on the blob type:
create index testindex on doc_prototype1(text) indextype is ctxsys.context
parameters ('filter ctxsys.inso_filter');
I also tried using auto_filter as well but it didn’t work.
I got the following error when I viewed the error log and the index tables were blank.
DRG-11207: user filter command exited with status 1 - DRG-11222: Third-party filter does not support this known document format.
Can anyone please help me out to resolve this problem and also to analyze the exact reason and the solution for the same.
Regards
Inderjeet -
On Oracle 11.2, I observed below
create index ind_jperson_1 on d_jperson(convict_ref);
create index ind_jperson_2 on d_jperson(driver_ref DESC);
select index_name,table_name,column_name,column_position,descend
from USER_IND_COLUMNS where table_name='D_JPERSON'
INDEX_NAME TABLE_NAME COLUMN_NAME COLUMN_POSITION DESCEND
IND_JPERSON_2 D_JPERSON SYS_NC00023$ 1 DESC
IND_JPERSON_1 D_JPERSON CONVICT_REF 1 ASCHow to find the exact table column for this index?user623617 wrote:
Surprise that DESC cause FBI. Then in what case will Oracle use it? The condition name='SMITH' will not use an index on upper(name). Need to use upper(name)='SMITH' to use the index.
To use in dex on upper(name) you need to crete FBI on upper(name).
Similarly if I have an index on (name desc), whould condition name='SMINTH' use the index.Yes, but at a higher cost than regular index (see access & filter):
SQL> create index emp_idx1 on emp(ename desc);
Index created.
SQL> explain plan for
2 select ename from emp where ename = 'SMITH';
Explained.
SQL> @?\rdbms\admin\utlxpls
PLAN_TABLE_OUTPUT
Plan hash value: 654424206
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 6 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| EMP_IDX1 | 1 | 6 | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
1 - access(SYS_OP_DESCEND("ENAME")=HEXTORAW('ACB2B6ABB7FF') )
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("ENAME"))='SMITH')
14 rows selected.
SQL>
Another question, if I have two indexes on both person(name asc) and person(name desc), what index Oracle will use when " where name='SMITH' "?
Unless you use INDEX_DESC hint, optimizer will use ASCindex since it has lower cost (Other decision affecting factor could be order by name desc):
SQL> create index emp_idx2 on emp(ename asc);
Index created.
SQL> explain plan for
2 select ename from emp where ename = 'SMITH';
Explained.
SQL> @?\rdbms\admin\utlxpls
PLAN_TABLE_OUTPUT
Plan hash value: 3999498872
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 6 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN| EMP_IDX2 | 1 | 6 | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
1 - access("ENAME"='SMITH')
13 rows selected.
SQL> explain plan for
2 select /*+ index_desc(emp) */ ename from emp where ename = 'SMITH';
Explained.
SQL> @?\rdbms\admin\utlxpls
PLAN_TABLE_OUTPUT
Plan hash value: 2940971887
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 6 | 1 (0)| 00:00:01 |
|* 1 | INDEX RANGE SCAN DESCENDING| EMP_IDX1 | 1 | 6 | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
PLAN_TABLE_OUTPUT
1 - access(SYS_OP_DESCEND("ENAME")=HEXTORAW('ACB2B6ABB7FF') )
filter(SYS_OP_UNDESCEND(SYS_OP_DESCEND("ENAME"))='SMITH' AND
SYS_OP_DESCEND("ENAME")=HEXTORAW('ACB2B6ABB7FF') )
15 rows selected.
SQL> SY. -
Newly created index not being used
Hello friends,
I am observing that a newly created index on a z table with mandt & a new field is not being used. I have already rebuild index & updated stats for table.
when we query on this table with where clause having same 2 fields mandt & other.. we expected this index to be used. This table is very large. What more i can do now ?
In trace/SQL session, we can see it is going full table scan.. and takes very long time.
this new field contain no data as of now for all existing rows. Is this the reason ? or sometihng else ?
SQL Statement
SELECT
FROM
"ABSA"
WHERE
"MANDT" = :A0 AND "ZABCD" = :A1
Execution Plan
Explain from v$sql_plan not possible -> Explain from PLAN_TABLE is displayed !
No values in v$sql_plan for Address: 0000000166710240 Hash_value: 3891403872 Child_number: 0 Sql_id:
SELECT STATEMENT ( Estimated Costs = 905.739 , Estimated #Rows = 110.190.667 )
1 TABLE ACCESS FULL ZABSA
( Estim. Costs = 905.739 , Estim. #Rows = 110.190.667 )
Estim. CPU-Costs = 152.614.535.266 Estim. IO-Costs = 899.784
Filter Predicates
NONUNIQUE Index ZABSA~Z01
Column Name #Distinct
MANDT 1
ZABCD 1
thanks & regards
ashish
Edited by: ashish vikas on Mar 3, 2012 9:05 PMashish vikas wrote:
> Execution Plan
> Explain from v$sql_plan not possible -> Explain from PLAN_TABLE is displayed !
> No values in v$sql_plan for Address: 0000000166710240 Hash_value: 3891403872 Child_number: 0 Sql_id:
>
> SELECT STATEMENT ( Estimated Costs = 905.739 , Estimated #Rows = 110.190.667 )
>
> 1 TABLE ACCESS FULL ZABSA
> ( Estim. Costs = 905.739 , Estim. #Rows = 110.190.667 )
> Estim. CPU-Costs = 152.614.535.266 Estim. IO-Costs = 899.784
> Filter Predicates
>
> NONUNIQUE Index ZABSA~Z01
> Column Name #Distinct
> MANDT 1
> ZABCD 1
Hi,
with this WHERE clause, both columns just one distinct value, the Full Table Scan is indded the best approach, beside
the point you only need a check to evaluate a value is NOT in the result.
In this case you should HINT the statement to the new index, because the DB will always assume that this index is non-selective.
Volker -
Hi,
Why is that I got different results for my queries?
Note that emp_date is indexed, so i dont want to use
a function to it.
QUERY1(full table scan)
SELECT COUNT(*) FROM EMP WHERE TRUNC(EMP_DATE)=TRUNC(SYSDATE-30); (RESULT=8,842)
QUERY2
SELECT COUNT(*) FROM EMP WHERE
EMP_DATE >=(SYSDATE-30) and EMP_DATE < (SYSDATE-30); (RESULT=0)
QUERY3
SELECT COUNT(*) FROM EMP WHERE
EMP_DATE BETWEEN TRUNC(SYSDATE-30) and TRUNC(SYSDATE-30); (RESULT=2,100)
Please help me how to use indexed date column...> Why is that I got different results for my queries?
Because your queries are different.
1) This one selects all records on 20 october, regardless of their time component
2) This one selects all records with an emp_date at least being 20 october 14:56:30 AND being smaller than 20 october 14:56:30. No record will ever satisfy this condition.
3) This one selects all records on 19./20 october at midnight 00:00:00
Please see this example:
SQL> create table myemp (emp_date)
2 as
3 select trunc(sysdate) - 30 +
4 case
5 when level <= 2100 then 0
6 when level <= 8842 then dbms_random.value(1,86399)/86400
7 else 2
8 end
9 from dual
10 connect by level <= 100000
11 /
Tabel is aangemaakt.
SQL> create index i1 on myemp(emp_date)
2 /
Index is aangemaakt.
SQL> exec dbms_stats.gather_table_stats(user,'myemp',cascade=>true)
PL/SQL-procedure is geslaagd.
SQL> set autotrace on explain
SQL> select count(*) from myemp where trunc(emp_date)=trunc(sysdate-30)
2 /
COUNT(*)
8842
1 rij is geselecteerd.
Uitvoeringspan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=88 Card=1 Bytes=8)
1 0 SORT (AGGREGATE)
2 1 TABLE ACCESS (FULL) OF 'MYEMP' (Cost=88 Card=1000 Bytes=
8000)
SQL> select count(*) from myemp where
2 emp_date >=(sysdate-30) and emp_date < (sysdate-30)
3 /
COUNT(*)
0
1 rij is geselecteerd.
Uitvoeringspan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=8)
1 0 SORT (AGGREGATE)
2 1 FILTER
3 2 INDEX (RANGE SCAN) OF 'I1' (NON-UNIQUE) (Cost=4 Card=2
50 Bytes=2000)
SQL> select count(*) from myemp where
2 emp_date between trunc(sysdate-30) and trunc(sysdate-30)
3 /
COUNT(*)
2100
1 rij is geselecteerd.
Uitvoeringspan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=8)
1 0 SORT (AGGREGATE)
2 1 FILTER
3 2 INDEX (RANGE SCAN) OF 'I1' (NON-UNIQUE) (Cost=4 Card=2
50 Bytes=2000)
> Please help me how to use indexed date column...
Use this query instead:
SQL> select count(*)
2 from myemp
3 where emp_date between trunc(sysdate)-30 and trunc(sysdate)-29 - interval '1' second
4 /
COUNT(*)
8842
1 rij is geselecteerd.
Uitvoeringspan
0 SELECT STATEMENT Optimizer=CHOOSE (Cost=2 Card=1 Bytes=8)
1 0 SORT (AGGREGATE)
2 1 FILTER
3 2 INDEX (RANGE SCAN) OF 'I1' (NON-UNIQUE) (Cost=4 Card=2
50 Bytes=2000)Regards,
Rob. -
How to index words containing letters as html entities?
The title says it all.
I am currently replacing known HTML entities with their Unicode counterparts upfront, but I was wondering if some built-in feature in Oracle Text could do the same and save an additional headache.
Indexed html entities anyone?
Thank you
Flavio
http://oraclequirks.blogspot.com
http://www.yocoya.comYou can create your own procedure that uses whatever method you like, then use that procedure in a procedure filter and use that procedure filter in your index parameters. In the example below, I have borrowed a strip_html function from
http://www.supermanhamuerto.com/doku.php?id=oracle:fixhtml
and used that in the procedure.
SCOTT@orcl12c_11gR2> set scan off
SCOTT@orcl12c_11gR2> -- table, data, and lexer:
SCOTT@orcl12c_11gR2> create table example (t varchar2(4000))
2 /
Table created.
SCOTT@orcl12c_11gR2> insert all
2 into example values ('crónicas y relatos')
3 into example values ('crónicas y relatos')
4 into example values ('CRÓnicas y Relatos de México')
5 into example values ('Crónicas y relatos de México')
6 select * from dual
7 /
4 rows created.
SCOTT@orcl12c_11gR2> begin
2 ctx_ddl.create_preference ('mylex', 'BASIC_LEXER');
3 ctx_ddl.set_attribute ( 'mylex', 'base_letter', 'YES');
4 end;
5 /
PL/SQL procedure successfully completed.
SCOTT@orcl12c_11gR2> -- function from http://www.supermanhamuerto.com/doku.php?id=oracle:fixhtml
SCOTT@orcl12c_11gR2> CREATE OR REPLACE FUNCTION strip_html(dirty IN clob,
2 to_cvs IN NUMBER DEFAULT 0)
3 RETURN clob IS OUT clob ;
4
5 TYPE arr_string IS varray (200) OF VARCHAR2(64);
6
7 entities_search_for arr_string;
8 entities_replace arr_string;
9 cont NUMBER;
10
11 BEGIN
12
13
14 -- to accelerate the issue
15 IF dirty IS NULL THEN
16 RETURN dirty;
17 END IF; -- isnull(dirty)
18
19 IF LENGTH( dirty ) = 0 THEN
20 RETURN dirty;
21 END IF; -- length(dirty)
22
23 entities_search_for := arr_string(
24 '!',
25 '#',
26 '$',
27 '%',
28 '&',
29 '"',
30 '(',
31 ')',
32 '*',
33 '+',
34 ',',
35 '‐',
36 '.',
37 '/',
38 ':',
39 ';',
40 '<',
41 '=',
42 '>',
43 '?',
44 '@',
45 '[',
46 '\',
47 ']',
48 'ˆ',
49 '_',
50 '`',
51 '{',
52 '|',
53 '}',
54 '˜',
55 ' ',
56 '¡',
57 '¢',
58 '£',
59 '¤',
60 '¥',
61 '¦',
62 '§',
63 '¨',
64 '©',
65 'ª',
66 '«',
67 '¬',
68 '­',
69 '®',
70 '¯',
71 '°',
72 '±',
73 '²',
74 '³',
75 '´',
76 'µ',
77 '¶',
78 '·',
79 '¸',
80 '¹',
81 'º',
82 '»',
83 '&fr;',
84 '&fr;',
85 '&fr;',
86 '¿',
87 'À',
88 'Á',
89 'Â',
90 'Ã',
91 'Ä',
92 'Å',
93 'Æ',
94 '&il;',
95 'È',
96 'É',
97 'Ê',
98 'Ë',
99 'Ì',
100 'Í',
101 'Î',
102 'Ï',
103 'Ð',
104 'Ñ',
105 'Ò',
106 'Ó',
107 'Ô',
108 'Õ',
109 'Ö',
110 '×',
111 'Ø',
112 'Ù',
113 'Ú',
114 'Û',
115 'Ü',
116 'Ý',
117 'Þ',
118 'ß',
119 'à',
120 'á',
121 'â',
122 'ã',
123 'ä',
124 'è',
125 'é',
126 'ê',
127 '&etilde;',
128 'ë',
129 'ì',
130 'í',
131 'î',
132 'ĩ',
133 'ï',
134 'ò',
135 'ó',
136 'ô',
137 'õ',
138 'ö',
139 'ù',
140 'ú',
141 'û',
142 'ũ',
143 'ü');
144
145 entities_replace := arr_string(
146 '¡',
147 'º',
148 '$',
149 '%',
150 '&',
151 '"',
152 '(',
153 ')',
154 '*',
155 '+',
156 ',',
157 '-',
158 '.',
159 'Sol',
160 'Colon',
161 '*',
162 '<',
163 '=',
164 '>',
165 '?',
166 ',',
167 '*',
168 '*',
169 '*',
170 '*',
171 '_',
172 '''',
173 '*',
174 '*',
175 '*',
176 '''',
177 ' ',
178 '¡',
179 'cent',
180 'L',
181 '*',
182 'Y',
183 '*',
184 '*',
185 '.',
186 '(c)',
187 '*',
188 '*',
189 '!',
190 '*',
191 '(r)',
192 '*',
193 '*',
194 '*',
195 '*',
196 '*',
197 'á',
198 'u',
199 '*',
200 '·',
201 'ç',
202 '*',
203 '*',
204 '*',
205 '*',
206 '*',
207 '*',
208 '¿',
209 'È',
210 'Á',
211 'Ä',
212 'Á',
213 '*',
214 '*',
215 'AE',
216 '*',
217 'È',
218 'É',
219 '*',
220 '*',
221 'Ì',
222 'Í',
223 'Î',
224 '*',
225 '*',
226 'N',
227 'Ò',
228 'Ó',
229 'Ô',
230 'O',
231 '*',
232 '*',
233 'O',
234 'Ù',
235 'Ú',
236 'Û',
237 '*',
238 '*',
239 '*',
240 '*',
241 'à',
242 'á',
243 'â',
244 'a',
245 '*',
246 'è',
247 'é',
248 'ê',
249 'e',
250 '*',
251 'ì',
252 'í',
253 'î',
254 'i',
255 '*',
256 'ò',
257 'ó',
258 'ô',
259 'o',
260 '*',
261 'ù',
262 'ú',
263 'û',
264 'u',
265 '*');
266
267 OUT := dirty;
268
269 -- replace what is enclosed between <xml> and </xml>
270 -- *? -> lazy star (catches the minimum possible)
271 OUT := regexp_replace(OUT, '<xml>.*?</xml>', '', 1, 0, 'ni' );
272 -- clean what it is inside the style tags
273 OUT := regexp_replace(OUT, '<style>.*?</style>', '', 1, 0, 'ni' );
274
275 IF to_cvs = 2 THEN
276 -- sanitize (not clean) the html
277
278 -- clean the tag <?xml:whatever>
279 OUT := regexp_replace(OUT, '<\?xml:.*?>', '', 1, 0, 'ni');
280 -- clean the tags <img whatever>
281 OUT := regexp_replace(OUT, '<img.*?>', '', 1, 0, 'ni');
282 -- clean comments
283 OUT := regexp_replace(OUT,'<!--.*?-->','', 1, 0, 'ni');
284 -- clean meta
285 OUT := regexp_replace(OUT,'<meta.*?>','', 1, 0, 'ni');
286 -- clean link
287 OUT := regexp_replace(OUT,'<link.*?>','', 1, 0, 'ni');
288 -- clean DIV
289 OUT := regexp_replace(OUT,'</?div.*?>','', 1, 0, 'ni');
290 -- clean SPAN
291 OUT := regexp_replace(OUT,'</?span.*?>','', 1, 0, 'ni');
292 -- clean "class inside tags"
293 OUT := regexp_replace(OUT,'(<.*?)class="?[a-zA-Z0-9-_]*"?(.*?>)', '\1\2', 1, 0, 'ni');
294 -- clean "style" inside the following tags: i b p
295 OUT := regexp_replace(OUT,'(<[ibp] .*?)style=".*?"(.*?>)', '\1\2', 1, 0, 'ni');
296 -- clean namespaces <o:p> </o:p>
297 OUT := regexp_replace(OUT, '(<)[a-zA-Z0-9-_]*:(.*?>)', '\1\2', 1, 0, 'ni');
298 OUT := regexp_replace(OUT, '(</)[a-zA-Z0-9-_]*:(.*?>)', '\1\2', 1, 0, 'ni');
299
300 -- clean empty opening and closing tags: it has to be
301 -- passed twice or three times to clean things like this:
302 -- <strong><u></u></strong>
303 -- TWEAK: <p></p> must be replaced by <br/>
304 OUT := regexp_replace(OUT,'<p></p>','<br/>', 1, 0, 'ni');
305 OUT := regexp_replace(OUT,'<([a-zA-Z0-9-_]*)></\1>','', 1, 0, 'ni');
306 -- TWEAK: <p></p> must be replaced by <br/>
307 OUT := regexp_replace(OUT,'<p></p>','<br/>', 1, 0, 'ni');
308 OUT := regexp_replace(OUT,'<([a-zA-Z0-9-_]*)></\1>','', 1, 0, 'ni');
309
310 ELSE
311 -- clean html
312
313 -- replace all the stuff that is similar to a carriage return
314 OUT := regexp_replace(OUT, '</p[^>]*>',CHR(10)||CHR(13));
315 OUT := regexp_replace(OUT, '</br[^>]*>',CHR(10)||CHR(13));
316 OUT := regexp_replace(OUT, '</tr[^>]*>',CHR(10)||CHR(13));
317
318 -- replace all the remaining html stuff
319 OUT := regexp_replace(OUT,'<[^>]*>','', 1, 0, 'ni');
320
321 -- replace all the entities
322 FOR cont IN 1..119 LOOP
323 OUT := REPLACE( OUT, entities_search_for(cont), entities_replace(cont) );
324 END LOOP;
325
326 -- cleaning for export to cvs
327 IF to_cvs = 1 THEN
328 OUT := REPLACE( OUT, CHR(10), '' );
329 OUT := REPLACE( OUT, CHR(13), '' );
330 OUT := REPLACE( OUT, CHR(9), '' );
331 OUT := REPLACE( OUT, ';', ',' );
332 OUT := REPLACE( OUT, '"', '''' );
333 END IF;
334
335
336 END IF;
337
338
339 RETURN(OUT);
340 END strip_html;
341 /
Function created.
SCOTT@orcl12c_11gR2> -- procedure that uses function:
SCOTT@orcl12c_11gR2> create or replace procedure normalize
2 (p_input in clob,
3 p_output in out nocopy clob)
4 as
5 begin
6 p_output := strip_html (p_input);
7 end normalize;
8 /
Procedure created.
SCOTT@orcl12c_11gR2> -- filter that uses procedure:
SCOTT@orcl12c_11gR2> begin
2 ctx_ddl.create_preference ('myfilt', 'procedure_filter');
3 ctx_ddl.set_attribute ('myfilt', 'procedure', 'normalize');
4 ctx_ddl.set_attribute ('myfilt', 'input_type', 'clob');
5 ctx_ddl.set_attribute ('myfilt', 'output_type', 'clob');
6 end;
7 /
PL/SQL procedure successfully completed.
SCOTT@orcl12c_11gR2> -- index that uses filter:
SCOTT@orcl12c_11gR2> create index myindex on example(t) indextype is ctxsys.context
2 parameters ('FILTER myfilt LEXER mylex')
3 /
Index created.
SCOTT@orcl12c_11gR2> -- tokens indexed:
SCOTT@orcl12c_11gR2> select token_text from dr$myindex$i
2 /
TOKEN_TEXT
CRONICAS
DE
MEXICO
RELATOS
Y
5 rows selected.
SCOTT@orcl12c_11gR2> -- searches:
SCOTT@orcl12c_11gR2> select * from example where contains (t, 'cronicas') > 0
2 /
T
crónicas y relatos
crónicas y relatos
CRÓnicas y Relatos de México
Crónicas y relatos de México
4 rows selected.
SCOTT@orcl12c_11gR2> select * from example where contains (t, 'Mexico') > 0
2 /
T
CRÓnicas y Relatos de México
Crónicas y relatos de México
2 rows selected.
Maybe you are looking for
-
My Mac is a lemon, but I want it to be an Apple.
Hello All: A few months ago, I purchased a Mac Powerbook G4 12". It is my first Mac purchase, and I love it! However, I have been having very weird issues with it. When I first got the comptuer, I turned it on a few days after the purchase and it wou
-
How can I save a file in CS5 that has been created by a newer version?
How can I save a file in CS5 that has been created by a newer version?
-
I downloaded Creative Cloud and downloaded photoshop (64 bit) but when I opened photoshop it says that my trial has expired, and it was my first time opening it.
-
Unable to download iTunes after error
Help! A while ago--I think it was after an update, but I don't really remember--I started getting the "Msvcr80.dll is missing" error message and my iTunes became non-functional. I have done everything I can find to resolve this, and finally wiped ev
-
Will Mountain Lion update erase my harddrive?
I'm just curious, that if I were to update from Lion to Mountain Lion on my Macbook Pro would all my documents, photos in iPhoto, iMovies, videos, music, downloads, etc. be erased or deleted?