Package com.google.appengine.api.search.Document

Examples of com.google.appengine.api.search.Document.Builder.addField()


                docBuilder.addField(Field.newBuilder().setName("numfield").setNumber(i));
                String dateVal = "" + cal.get(Calendar.YEAR) + ",";
                dateVal += cal.get(Calendar.MONTH) + ",";
                int day = cal.get(Calendar.DATE) + i;
                dateVal += day;
                docBuilder.addField(Field.newBuilder().setName("datefield").setDate(dfDate.parse(dateVal)));
                docBuilder.addField(Field.newBuilder().setName("htmlfield").setHTML("<B>html</B> " + i));
                docBuilder.addField(Field.newBuilder().setName("atomfield").setAtom("atom" + i + ".com"));
                GeoPoint geoPoint = new GeoPoint((double) i, (double) (100 + i));
                docBuilder.addField(Field.newBuilder().setName("geofield").setGeoPoint(geoPoint));
                // two field in same name and with different field type
View Full Code Here


                String dateVal = "" + cal.get(Calendar.YEAR) + ",";
                dateVal += cal.get(Calendar.MONTH) + ",";
                int day = cal.get(Calendar.DATE) + i;
                dateVal += day;
                docBuilder.addField(Field.newBuilder().setName("datefield").setDate(dfDate.parse(dateVal)));
                docBuilder.addField(Field.newBuilder().setName("htmlfield").setHTML("<B>html</B> " + i));
                docBuilder.addField(Field.newBuilder().setName("atomfield").setAtom("atom" + i + ".com"));
                GeoPoint geoPoint = new GeoPoint((double) i, (double) (100 + i));
                docBuilder.addField(Field.newBuilder().setName("geofield").setGeoPoint(geoPoint));
                // two field in same name and with different field type
                docBuilder.addField(Field.newBuilder().setName("mixfield").setText("text and number mix field"));
View Full Code Here

                dateVal += cal.get(Calendar.MONTH) + ",";
                int day = cal.get(Calendar.DATE) + i;
                dateVal += day;
                docBuilder.addField(Field.newBuilder().setName("datefield").setDate(dfDate.parse(dateVal)));
                docBuilder.addField(Field.newBuilder().setName("htmlfield").setHTML("<B>html</B> " + i));
                docBuilder.addField(Field.newBuilder().setName("atomfield").setAtom("atom" + i + ".com"));
                GeoPoint geoPoint = new GeoPoint((double) i, (double) (100 + i));
                docBuilder.addField(Field.newBuilder().setName("geofield").setGeoPoint(geoPoint));
                // two field in same name and with different field type
                docBuilder.addField(Field.newBuilder().setName("mixfield").setText("text and number mix field"));
                docBuilder.addField(Field.newBuilder().setName("mixfield").setNumber(987));
View Full Code Here

                dateVal += day;
                docBuilder.addField(Field.newBuilder().setName("datefield").setDate(dfDate.parse(dateVal)));
                docBuilder.addField(Field.newBuilder().setName("htmlfield").setHTML("<B>html</B> " + i));
                docBuilder.addField(Field.newBuilder().setName("atomfield").setAtom("atom" + i + ".com"));
                GeoPoint geoPoint = new GeoPoint((double) i, (double) (100 + i));
                docBuilder.addField(Field.newBuilder().setName("geofield").setGeoPoint(geoPoint));
                // two field in same name and with different field type
                docBuilder.addField(Field.newBuilder().setName("mixfield").setText("text and number mix field"));
                docBuilder.addField(Field.newBuilder().setName("mixfield").setNumber(987));
                docBuilder.setId("selfid" + i);
                // only doc(id="selfid0") has "cn" locale, others have "en" locale
View Full Code Here

                docBuilder.addField(Field.newBuilder().setName("htmlfield").setHTML("<B>html</B> " + i));
                docBuilder.addField(Field.newBuilder().setName("atomfield").setAtom("atom" + i + ".com"));
                GeoPoint geoPoint = new GeoPoint((double) i, (double) (100 + i));
                docBuilder.addField(Field.newBuilder().setName("geofield").setGeoPoint(geoPoint));
                // two field in same name and with different field type
                docBuilder.addField(Field.newBuilder().setName("mixfield").setText("text and number mix field"));
                docBuilder.addField(Field.newBuilder().setName("mixfield").setNumber(987));
                docBuilder.setId("selfid" + i);
                // only doc(id="selfid0") has "cn" locale, others have "en" locale
                if (i == 0) {
                    docBuilder.setLocale(new Locale("cn"));
View Full Code Here

                docBuilder.addField(Field.newBuilder().setName("atomfield").setAtom("atom" + i + ".com"));
                GeoPoint geoPoint = new GeoPoint((double) i, (double) (100 + i));
                docBuilder.addField(Field.newBuilder().setName("geofield").setGeoPoint(geoPoint));
                // two field in same name and with different field type
                docBuilder.addField(Field.newBuilder().setName("mixfield").setText("text and number mix field"));
                docBuilder.addField(Field.newBuilder().setName("mixfield").setNumber(987));
                docBuilder.setId("selfid" + i);
                // only doc(id="selfid0") has "cn" locale, others have "en" locale
                if (i == 0) {
                    docBuilder.setLocale(new Locale("cn"));
                } else {
View Full Code Here

    public void testCreateDocument() throws Exception {
        String indexName = "test-doc";
        Index index = searchService.getIndex(IndexSpec.newBuilder().setName(indexName));
        delDocs(index);
        Builder docBuilder = Document.newBuilder().setId("tck").setLocale(Locale.FRENCH).setRank(8);
        docBuilder.addField(Field.newBuilder().setName("field1").setText("text field"));
        docBuilder.addField(Field.newBuilder().setName("field1").setNumber(987));
        docBuilder.addField(Field.newBuilder().setName("field2").setNumber(123));
        docBuilder.addField(Field.newBuilder().setName("field3").setDate(new Date()));
        index.put(docBuilder.build());
        sync();
View Full Code Here

        String indexName = "test-doc";
        Index index = searchService.getIndex(IndexSpec.newBuilder().setName(indexName));
        delDocs(index);
        Builder docBuilder = Document.newBuilder().setId("tck").setLocale(Locale.FRENCH).setRank(8);
        docBuilder.addField(Field.newBuilder().setName("field1").setText("text field"));
        docBuilder.addField(Field.newBuilder().setName("field1").setNumber(987));
        docBuilder.addField(Field.newBuilder().setName("field2").setNumber(123));
        docBuilder.addField(Field.newBuilder().setName("field3").setDate(new Date()));
        index.put(docBuilder.build());
        sync();
View Full Code Here

        Index index = searchService.getIndex(IndexSpec.newBuilder().setName(indexName));
        delDocs(index);
        Builder docBuilder = Document.newBuilder().setId("tck").setLocale(Locale.FRENCH).setRank(8);
        docBuilder.addField(Field.newBuilder().setName("field1").setText("text field"));
        docBuilder.addField(Field.newBuilder().setName("field1").setNumber(987));
        docBuilder.addField(Field.newBuilder().setName("field2").setNumber(123));
        docBuilder.addField(Field.newBuilder().setName("field3").setDate(new Date()));
        index.put(docBuilder.build());
        sync();

        Results<ScoredDocument> result = searchDocs(index, "", 0);
View Full Code Here

        delDocs(index);
        Builder docBuilder = Document.newBuilder().setId("tck").setLocale(Locale.FRENCH).setRank(8);
        docBuilder.addField(Field.newBuilder().setName("field1").setText("text field"));
        docBuilder.addField(Field.newBuilder().setName("field1").setNumber(987));
        docBuilder.addField(Field.newBuilder().setName("field2").setNumber(123));
        docBuilder.addField(Field.newBuilder().setName("field3").setDate(new Date()));
        index.put(docBuilder.build());
        sync();

        Results<ScoredDocument> result = searchDocs(index, "", 0);
        assertEquals(1, result.getNumberReturned());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.