Can you create an index on a Map?

I have a few questions that I can't seem to figure out nor find a viable example for. Can you create an index for a Map contained within a nested object, and if so, how would you do this? I currently have a Filter the inspects this criteria in the cache but am unable to figure out to create a usabe index for the custom filter. I'm using Coherence 3.5.2 - any help would be most appreciated. I'm not sure if/what I need to do with the SimpleMapIndex....
Here's the basic object map below. My filter is retrieving all of the CustomerGroup objects that have a Customer in it's collection that contains the passed in Integer value in the Customer's Map. So can you create an Index on a Map (and a nested one at that) and how do you that? The index would need to be on the nested customerValues hashmap.
class CustomerGroup
    Set<Customer> customers ;
class Customer
    Map<Integer, CustumerValue> customerValues;
}

If you write a custom ValueExtractor, which you need to create an index, then you will not need a custom Filter.
Depending on how efficient you need to be you custom extractor can use POF and not have to deserialize the entries to create the index, or it can deserialize the class, which will make the code more straight forward.
For example, without using POF
public class MapKeyExtractor extends EntryExtractor implements PortableObject {
    public MapKeyExtractor() {
    @Override
    public Object extractFromEntry(Map.Entry entry) {
        Set<Integer> keys = new HashSet<Integer>();
        CustomerGroup group = (CustomerGroup) entry.getValue();
        Set<Customer> customers = group.getCustomers();
        for (Customer customer : customers) {
            keys.addAll(customer.getCustomerValues().keySet());
        return keys;
    @Override
    public boolean equals(Object obj) {
        return (obj instanceof MapKeyExtractor);
    @Override
    public int hashCode() {
        return MapKeyExtractor.class.hashCode();
    @Override
    public void readExternal(PofReader in) throws IOException {
        super.readExternal(in);
    @Override
    public void writeExternal(PofWriter out) throws IOException {
        super.writeExternal(out);
}The extractor above will return a collection of all of the Integer values in the keys of all the customerValues of all the customers in a CustomerGroup (I have guessed you might have accessor methods on the classes you posted).
You can then use a ContainsFilter for your query. For example to get all the values from the cache where the customerValues map contains a 19 in the key...
Set results = cache.entrySet(new ContainsFilter(new MapKeyExtractor(), 19));You could write a version of the MapKeyExtractor that uses POF and would not deserialize the values but this would be more complicated code as it would need to extract the Map from the POF stream of the value and walk down the keys and values extracting the keys. It is doable but not worth it unless you are really worried about performance of index updates.
Discalimer I have written the code above from the top of my head so have not compiled it or tested it but it should be OK.
JK

Similar Messages

  • Can you create an image map hotspot for an external URL in Dreamweaver CS6?

    Can you create an image map hotspot for an external URL in Dreamweaver CS6?

    Duplicate post: http://forums.adobe.com/thread/1338701?tstart=0

  • Can you create a site map with Dreamweaver?

    Greetings,
    Can you create a site map with Dreamweaver?
    Crawkers do not work because many of my pages are not linked.
    Thanks

    I'm not too sure what Crawkers is, but I do not think DW has that capability out of the box.  There are some web based solutions that will scan you site for you and give you a map for search engines.  I choose to go with a commercial option which is pretty good from WebAssist, it's called Surveyor: http://www.webassist.com/dreamweaver-extensions/surveyor/ .

  • How do you create an index in Pages 08?

    Can you create an word index at the end of a research document in Pages 08? I've done this using Microsoft Word, but I can't find the function in Pages.
    I'm brand new to the Mac world, btw.

    This function is not available in Pages 08.
    There may be a third-party application that can do this.
    Good luck,
    Terry
    You might want to give Apple some feedback on this feature using the 'Provide Pages Feedback' option in the Pages menu.

  • How do you create an Index in Pages?

    Hi all,
    I can see how you can create Headings but I can't see how you create an Index! Surely the point of creating Headings is so they can be referenced by an index, so if anyone's got any suggestions I'd be glad to hear them
    ciao

    Thanks Muhammad. As you say, this is okay for a table of contents, but not for an index.
    The only option seems to be to create one 'manually'. I have found two suggestions to use a search to assist with this:
    • one using find: http://pagesfaq.blogspot.com.au/2008/01/how-do-i-create-index-in-pages.html
    • another using Applescript: http://superuser.com/questions/84580/making-an-index-in-apple-iwork-pages
    Perhaps this will be one of the pieces of functionality, along with other things like easily merging to labels, that will be added to the next version of Pages (please Apple)?

  • Can we create secondary indexes in pooled and cluster table?

    hello all
    can we create secondary indexes in pooled and cluster table?

    Hi,
    Yes, you can.
    Refer the below links
    [http://www.sap-img.com/abap/the-different-types-of-sap-tables.htm|http://www.sap-img.com/abap/the-different-types-of-sap-tables.htm]
    [http://help.sap.com/saphelp_40b/helpdata/en/cf/21f083446011d189700000e8322d00/content.htm|http://help.sap.com/saphelp_40b/helpdata/en/cf/21f083446011d189700000e8322d00/content.htm]
    Regards,
    SB

  • Can we create secondary index for a cluster table

    hi
    can we create secondary index for a cluster table

    Jyothsna,
    There seems to be some kind of misunderstanding here. You <i>cannot</i> create a secondary index on a cluster table. A cluster table does not exist as a separate physical table in the database; it is part of a "physical cluster". In the case of BSEG for instance, the physical cluster is RFBLG. The only fields of the cluster table that also exist as fields of the physical cluster are the leading fields of the primary key. Taking again BSEG as the example, the primary key includes the fields MANDT, BUKRS, BELNR, GJAHR, BUZEI. If you look at the structure of the RFBLG table, you will see that it has primary key fields MANDT, BUKRS, BELNR, GJAHR, PAGENO. The first four fields are those that all cluster tables inside BSEG have in common. The fifth field, PAGENO, is a "technical" field giving the sequence number of the current record in the series of cluster records sharing the same primary key.
    All the "functional" fields of the cluster table (for BSEG this is field BUZEI and everything beyond that) exist only inside a raw binary object. The database does not know about these fields, it only sees the raw object (the field VARDATA of the physical cluster). Since the field does not exist in the database, it is impossible to create a secondary index on it. If you try to create a secondary index on a cluster table in transaction SE11, you will therefore rightly get the error "Index maintenance only possible for transparent tables".
    Theoretically you could get around this by converting the cluster table to a transparent table. You can do this in the SAP dictionary. However, in practice this is almost never a good solution. The table becomes much larger (clusters are compressed) and you lose the advantage that related records are stored close to each other (the main reason for having cluster tables in the first place). Apart from the performance and disk space hit, converting a big cluster table like BSEG to transparent would take extremely long.
    In cases where "indexing" of fields of a cluster table is worthwhile, SAP has constructed "indexing tables" around the cluster. For example, around BSEG there are transparent tables like BSIS, BSAS, etc. Other clusters normally do not have this, but that simply means there is no reason for having it. I have worked with the SAP dictionary for over 12 years and I have never met a single case where it was necessary to convert a cluster to transparent.
    If you try to select on specific values of a non-transparent field in a cluster without also specifying selections for the primary key, then the database will have to do a serial read of the whole physical cluster (and the ABAP DB interface will have to decompress every single record to extract the fields). The performance of that is monstrous -- maybe that was the reason of your question. However, the solution then is (in the case of BSEG) to query via one of the index tables (where you are free to create secondary indexes since those tables are transparent).
    Hope this clarifies things,
    Mark

  • Why I can't create ConText index?

    Hi everyone.
    I install Oracle9i(v9.0.1.1) in my computer.
    I create a table, insert a xml document into it, but I can't create ConText index
    on it.
    How can I solve this problem ?
    Thank you.
    SQL> create table xtest(doc sys.xmltype);
    SQL> insert into xtest values (sys.xmltype.createxml('<A>simple</A>'));
    SQL> alter session set query_rewrite_enabled = true;
    SQL> alter session set query_rewrite_integrity = trusted;
    SQL> create index xtestx on xtest(doc)
    2 indextype is ctxsys.context;
         ORA-29855: An error occur when execute ODCIINDEXCREATE
         ORA-20000: Oracle Text error:
         DRG-50857: oracle error in drixtab.create_index_tables
         ORA-01031: insufficient privileges
         ORA-06512: in "CTXSYS.DRUE", line 157
         ORA-06512: in "CTXSYS.TEXTINDEXMETHODS", line 176

    I've solve this problem.
    I ues PL/SQL Developer. When I connect as SYSDBA, create index fail.
    But if I connect as normal, it succeed!

  • Can you creat an apple id through the computer?

    Can you create an apple id through the computer?

    Yes.
    https://appleid.apple.com/cgi-bin/WebObjects/MyAppleId.woa/

  • Can you creat an Apple ID using the iTunes gift cards?

    Can you creat an Apple ID using the iTunes gift cards?

    Jack, are you trying to make a new account on a computer or and iOS device, you need to click the links and follow the instruction to make the account without a credit card.  After you make your account then redeem your iTunes card. http://support.apple.com/kb/ht2534

  • Can you create apps after 1st May 2015 using Adobe DPS single edition?

    Can you create apps after 1st May 2015 using Adobe DPS single edition?
    I currently have SE via creatieve cloud - one of the only reasons we switched to CC was for the DPS SE.
    Does anyone know if this capability will just be 'switched off' at midnight 1st May 2015?? There are huge costs for going the enterprise route but with no date in sight for Publish to be launched I am not sure I can wait for this, or should I???

    Adobe states: Please note that the Digital Publishing Suite, Single Edition, service will be available for use until May 1, 2015, but beyond that date the service will no longer be available.
    So essentially my licence will expire on 1st May - Adobe's note just mentions 'service' -  even though part of CC and I will not be able to maintain my app or create any more IPA's after 1st May. I can't beleive there is nothing to switch over to other than paying thousands of pounds for enterprise??
    Just all so vauge, feels like a plug is going to be pulled and thats it??? Maybe I am missing something?

  • Can you create a file without presenter's notes?

    Can you create/export a file that won't be able see presenter's notes, either in Keynote or PPT format?

    Yes, I can export to pdf without the notes. I was wondering if it was possible to send someone the slides in PPT format without including my presenters' notes.
    They are lecture slides for a class, so I am giving my students copies in pdf, but I might want to give them to someone else in a format they can edit and use as slides, but without having my notes to myself in there. I suppose it's not designed for such an option, as far as I can tell, hiding the notes doesn't make a difference if exporting to PPT.

  • How can you create a spry menu bar with no background colour?

    How can you create the first level of a spry menu bar to have no colour? I have a coloured background right now and the colour matches when you load the site in Internet explorer but does not match in Firefox. Any suggestions are welcomed on how to fix this.
    Thanks!
    HK

    Here is the site:
    http://partnersnaturally.ca/
    I am learning with code, (obviously) so any feedback would be nice. I use dreamweaver CS4, but when I originally designed the site it was in a much older version of dreamweaver. I wonder if that could also be a cause. (besides human error)
    Thanks again,
    HK

  • How can you create a writable PDF document from a PPT presentation ?

    How can you create a writable PDF document from a PPT presentation ? Upper part with the image , lower part with a free space in order to take notes for students during presentation or course.
    Thanks.
    B

    You can make a PDF file out of you notes and handouts but using the Adobe PDF printer.
    Open your PowerPoint Document then go to “File” “Print”
    Select ‘Adobe PDF” Printer
    Under slides, select which way you want to print. Note it will not print to a printer but to a PDF file.
    After then go into printer Properties and Setup PDF properties, do the following: (see second image below)
    Default: PDF/A 1-b
    Adobe Security: none (change as needed)
    Adobe Output folder: Prompt for Adobe file name
    Adobe Page size: Letter (change as needed)
    Check the following check boxes
    View Adobe PDf Results,
    Add Document Information,
    Rely on system fonts only,
    Delete Log files for successful jobs.
    Select OK
    A pop will ask you where you want to save the document. The file extension should be PDF. After giving the file name select okay and the file should popup as a PDF. Down side is if you want to speaker notes included then you will have to do another file, like wise with just screen shots then combine into one PDF document.
    I used Acrobat IX Pro. So to do this you need Acrobat IX or X Pro.
    Hope this will help.
    Tiger26

  • How can you create a playlist with music and music video and play those from same playlist through Apple TV?

    How can you create a playlist on Ipod touch with music and music video,  and play those from same playlist through Apple TV?  I can download, create a playlist with both music and music video, stream that through the Apple TV with no problem.  The sound and the information show up on the TV, but when it gets to a music video, it only shows the information and "artwork".
    I also have a video playlist - videos play fine through the Apple TV, but will not shuffle through all videos - continues to repeat the same one.  I have most definitely selected shuffle in both locations - from the playlist and on the ipod video screen while video is playing.

    I finally got it... had to sync the photos with the music in iMovie, arrange the voiceover in GarageBand then export to iTunes, and then I was able to put it all together in iMovie and burn in iDVD... had a few glitches along the way but finally finished : )
    Message was edited by: jpewald

Maybe you are looking for

  • Restoring backed-up files with Backup

    I'm restoring a large amount of data that I backed up on an external drive using Backup. I didn't realize that every three or four incremental backups I was supposed to force another "full backup," and now I am faced with restoring 178 incremental fi

  • How to Hide Variants in Browser

    Hi,   I have a Query with 3 variables , say A,B and C. Both A and B are mandatory while C is optional. I have created 2 variants , variant x and y. variant x with variable values as: A with value 0 (show) B with value 1 (show) C with value 2 (hide) v

  • PCR Operations/Functions

    Hi All, Can you pls let me know the operations to read  employee start date, a date type from IT 0041and leave start date in the PCR. Thanks, Karunakar

  • Will pse 8 recognize an olympus sp 350 specifically in the camera raw calibration area

    Does pse 8 recognize an olympus sp 350 in the camera raw calibration area.....in pse 7 the only option I get is adobe standard beta 2....would it be worth it to upgrade to pse 8

  • Tomcat Help?!

    When trying to load my web page (a jsp) with my newly set up tomcat web server (which seems to be working fine with the default tomcat stuff) I get the following error: org.apache.jasper.JasperException: This absolute uri (http://java.sun.com/jstl/co