[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
ogterran, Unfortunately the SearchableModel indexes all StringProperties and TextProperties in the model. You will need to create another model that contains only the items you want to index. Something like: class Product(db.Model): pid = db.StringProperty(required=True) title = db.StringProperty(required=True) site = db.StringProperty(required=True) url = db.LinkProperty(required=True) class ProductSearchIndex(search.SearchableModel): product = db.ReferenceProperty(Product) title = db.StringProperty(required=True) On Wed, Jun 10, 2009 at 6:11 PM, ogterran wrote: > > Hi, > > When I create a datastore model using SearchableModel, it creates a > __searchable_text_index column, for full text search. > If I don't want all the columns to be part of the index for search, > how do I exclude columns for full text search? > > i.e. > I don't want pid, site, and url to be part of the full text search. > > class Product(search.SearchableModel): >pid = db.StringProperty(required=True) >title = db.StringProperty(required=True) >site = db.StringProperty(required=True) >url = db.LinkProperty(required=True) > > Thanks > Jon > > > -- === 株式会社ビープラウド イアン・ルイス 〒150-0012 東京都渋谷区広尾1-11-2アイオス広尾ビル604 email: ianmle...@beproud.jp TEL:03-5795-2707 FAX:03-5795-2708 http://www.beproud.jp/ === --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
Hi Ian, Thanks for the response. I have one question on number of datastore calls. How many datastore calls is the query below making? Is it 1 or 100? > class Product(db.Model): >pid = db.StringProperty(required=True) >title = db.StringProperty(required=True) >site = db.StringProperty(required=True) >url = db.LinkProperty(required=True) > > class ProductSearchIndex(search.SearchableModel): >product = db.ReferenceProperty(Product) >title = db.StringProperty(required=True) query = ProductSearchIndex.all().search(searchtext) results = query.fetch(100) for i, v in enumerate(results): print v.product.url Thanks Jon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
Hi ogterran, On Tue, Jun 23, 2009 at 9:59 AM, ogterran wrote: > > Hi Ian, > > Thanks for the response. > I have one question on number of datastore calls. > How many datastore calls is the query below making? > Is it 1 or 100? > > > class Product(db.Model): > >pid = db.StringProperty(required=True) > >title = db.StringProperty(required=True) > >site = db.StringProperty(required=True) > >url = db.LinkProperty(required=True) > > > > class ProductSearchIndex(search.SearchableModel): > >product = db.ReferenceProperty(Product) > >title = db.StringProperty(required=True) > > query = ProductSearchIndex.all().search(searchtext) > results = query.fetch(100) > for i, v in enumerate(results): >print v.product.url Only one query - your search terms are ANDed together. -Nick Johnson > > Thanks > Jon > > > > -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
ogterran, It should do one for the search and then one for each item in the search result. If you are worried performance on the calls to the datastore you can modify this code to make the ProductSearchIndex entity be a child of the Product entity and use a key only query to retrieve only the keys for the search index entities (since we only really care about the Products anyway). This will still to the same number of queries but will avoid the overhead of deserializing the ProductSearchIndex objects (and the associated index list property which might be long). Something like the following should work: class Product(db.Model): pid = db.StringProperty(required=True) title = db.StringProperty(required=True) site = db.StringProperty(required=True) url = db.LinkProperty(required=True) class ProductSearchIndex(search.SearchableModel): # parent == Product title = db.StringProperty(required=True) ... # where you write the Product product = Product(pid = pid, title=title, site=site, url=url) product.put() index = ProductSearchIndex(parent=product, title=title) index.put() ... # where you search keys = ProductSearchIndex.all(keys_only=True).search(query).fetch(100) for key in keys: product = Product.get(key.parent()) print product.url On Tue, Jun 23, 2009 at 5:59 PM, ogterran wrote: > > Hi Ian, > > Thanks for the response. > I have one question on number of datastore calls. > How many datastore calls is the query below making? > Is it 1 or 100? > > > class Product(db.Model): > >pid = db.StringProperty(required=True) > >title = db.StringProperty(required=True) > >site = db.StringProperty(required=True) > >url = db.LinkProperty(required=True) > > > > class ProductSearchIndex(search.SearchableModel): > >product = db.ReferenceProperty(Product) > >title = db.StringProperty(required=True) > > query = ProductSearchIndex.all().search(searchtext) > results = query.fetch(100) > for i, v in enumerate(results): >print v.product.url > > Thanks > Jon > > > > -- === 株式会社ビープラウド イアン・ルイス 〒150-0012 東京都渋谷区広尾1-11-2アイオス広尾ビル604 email: ianmle...@beproud.jp TEL:03-5795-2707 FAX:03-5795-2708 http://www.beproud.jp/ === --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
Nick, But he is also doing v.product which will do a get() by key for each Product entity will it not? On Tue, Jun 23, 2009 at 7:14 PM, Nick Johnson (Google) < nick.john...@google.com> wrote: > Hi ogterran, > > On Tue, Jun 23, 2009 at 9:59 AM, ogterran wrote: > >> >> Hi Ian, >> >> Thanks for the response. >> I have one question on number of datastore calls. >> How many datastore calls is the query below making? >> Is it 1 or 100? >> >> > class Product(db.Model): >> >pid = db.StringProperty(required=True) >> >title = db.StringProperty(required=True) >> >site = db.StringProperty(required=True) >> >url = db.LinkProperty(required=True) >> > >> > class ProductSearchIndex(search.SearchableModel): >> >product = db.ReferenceProperty(Product) >> >title = db.StringProperty(required=True) >> >> query = ProductSearchIndex.all().search(searchtext) >> results = query.fetch(100) >> for i, v in enumerate(results): >>print v.product.url > > > Only one query - your search terms are ANDed together. > > -Nick Johnson > > >> >> Thanks >> Jon >> >> >> > > > -- > Nick Johnson, App Engine Developer Programs Engineer > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: > 368047 > > > > > -- === 株式会社ビープラウド イアン・ルイス 〒150-0012 東京都渋谷区広尾1-11-2アイオス広尾ビル604 email: ianmle...@beproud.jp TEL:03-5795-2707 FAX:03-5795-2708 http://www.beproud.jp/ === --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
2009/6/23 Ian Lewis > ogterran, > > It should do one for the search and then one for each item in the search > result. Not quite - it will do one _query_, and multiple gets. A get is much, much cheaper than a query. You're right about the number of round-trips, though. > If you are worried performance on the calls to the datastore you can modify > this code to make the ProductSearchIndex entity be a child of the Product > entity and use a key only query to retrieve only the keys for the search > index entities (since we only really care about the Products anyway). Good idea! > > > This will still to the same number of queries but will avoid the overhead > of deserializing the ProductSearchIndex objects (and the associated index > list property which might be long). > > Something like the following should work: > > class Product(db.Model): >pid = db.StringProperty(required=True) >title = db.StringProperty(required=True) >site = db.StringProperty(required=True) >url = db.LinkProperty(required=True) > > class ProductSearchIndex(search.SearchableModel): ># parent == Product >title = db.StringProperty(required=True) > > ... > # where you write the Product > product = Product(pid = pid, title=title, site=site, url=url) > product.put() > index = ProductSearchIndex(parent=product, title=title) > index.put() > > ... > # where you search > keys = ProductSearchIndex.all(keys_only=True).search(query).fetch(100) > for key in keys: > product = Product.get(key.parent()) > print product.url This can be done much more efficiently: keys = ProductSearchIndex.all(keys_only=True).search(query).fetch(100) products = db.get(x.parent() for x in keys) Now you're down to just two round-trips! -Nick Johnson > > > On Tue, Jun 23, 2009 at 5:59 PM, ogterran wrote: > >> >> Hi Ian, >> >> Thanks for the response. >> I have one question on number of datastore calls. >> How many datastore calls is the query below making? >> Is it 1 or 100? >> >> > class Product(db.Model): >> >pid = db.StringProperty(required=True) >> >title = db.StringProperty(required=True) >> >site = db.StringProperty(required=True) >> >url = db.LinkProperty(required=True) >> > >> > class ProductSearchIndex(search.SearchableModel): >> >product = db.ReferenceProperty(Product) >> >title = db.StringProperty(required=True) >> >> query = ProductSearchIndex.all().search(searchtext) >> results = query.fetch(100) >> for i, v in enumerate(results): >>print v.product.url >> >> Thanks >> Jon >> >> >> > > > -- > === > 株式会社ビープラウド イアン・ルイス > 〒150-0012 > 東京都渋谷区広尾1-11-2アイオス広尾ビル604 > email: ianmle...@beproud.jp > TEL:03-5795-2707 > FAX:03-5795-2708 > http://www.beproud.jp/ > === > > > > -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
Whenever I've tried doing a SearchableModelDescendant.all (keys_only=True).search(query) construction, it has failed saying it doesn't understand the keys_only parameter - see 'Using __key__ and SearchableModel http://groups.google.com/group/google-appengine/browse_thread/thread/73dc1dc31bfd497b Do you know if this was fixed in a recent release? Adrian On Jun 23, 11:33 am, "Nick Johnson (Google)" wrote: > 2009/6/23 Ian Lewis > > > ogterran, > > > It should do one for the search and then one for each item in the search > > result. > > Not quite - it will do one _query_, and multiple gets. A get is much, much > cheaper than a query. You're right about the number of round-trips, though. > > > If you are worried performance on the calls to the datastore you can modify > > this code to make the ProductSearchIndex entity be a child of the Product > > entity and use a key only query to retrieve only the keys for the search > > index entities (since we only really care about the Products anyway). > > Good idea! > > > > > > > This will still to the same number of queries but will avoid the overhead > > of deserializing the ProductSearchIndex objects (and the associated index > > list property which might be long). > > > Something like the following should work: > > > class Product(db.Model): > >pid = db.StringProperty(required=True) > >title = db.StringProperty(required=True) > >site = db.StringProperty(required=True) > >url = db.LinkProperty(required=True) > > > class ProductSearchIndex(search.SearchableModel): > ># parent == Product > >title = db.StringProperty(required=True) > > > ... > > # where you write the Product > > product = Product(pid = pid, title=title, site=site, url=url) > > product.put() > > index = ProductSearchIndex(parent=product, title=title) > > index.put() > > > ... > > # where you search > > keys = ProductSearchIndex.all(keys_only=True).search(query).fetch(100) > > for key in keys: > > product = Product.get(key.parent()) > > print product.url > > This can be done much more efficiently: > keys = ProductSearchIndex.all(keys_only=True).search(query).fetch(100) > products = db.get(x.parent() for x in keys) > > Now you're down to just two round-trips! > > -Nick Johnson > > > > > > > On Tue, Jun 23, 2009 at 5:59 PM, ogterran wrote: > > >> Hi Ian, > > >> Thanks for the response. > >> I have one question on number of datastore calls. > >> How many datastore calls is the query below making? > >> Is it 1 or 100? > > >> > class Product(db.Model): > >> >pid = db.StringProperty(required=True) > >> >title = db.StringProperty(required=True) > >> >site = db.StringProperty(required=True) > >> >url = db.LinkProperty(required=True) > > >> > class ProductSearchIndex(search.SearchableModel): > >> >product = db.ReferenceProperty(Product) > >> >title = db.StringProperty(required=True) > > >> query = ProductSearchIndex.all().search(searchtext) > >> results = query.fetch(100) > >> for i, v in enumerate(results): > >>print v.product.url > > >> Thanks > >> Jon > > > -- > > === > > 株式会社ビープラウド イアン・ルイス > > 〒150-0012 > > 東京都渋谷区広尾1-11-2アイオス広尾ビル604 > > email: ianmle...@beproud.jp > > TEL:03-5795-2707 > > FAX:03-5795-2708 > >http://www.beproud.jp/ > > === > > -- > Nick Johnson, App Engine Developer Programs Engineer > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: > 368047 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
You're quite right. This will be fixed in a future release. -Nick Johnson 2009/6/23 acuth > > Whenever I've tried doing a SearchableModelDescendant.all > (keys_only=True).search(query) construction, it has failed saying it > doesn't understand the keys_only parameter - see 'Using __key__ and > SearchableModel > http://groups.google.com/group/google-appengine/browse_thread/thread/73dc1dc31bfd497b > > Do you know if this was fixed in a recent release? > > Adrian > > > On Jun 23, 11:33 am, "Nick Johnson (Google)" > wrote: > > 2009/6/23 Ian Lewis > > > > > ogterran, > > > > > It should do one for the search and then one for each item in the > search > > > result. > > > > Not quite - it will do one _query_, and multiple gets. A get is much, > much > > cheaper than a query. You're right about the number of round-trips, > though. > > > > > If you are worried performance on the calls to the datastore you can > modify > > > this code to make the ProductSearchIndex entity be a child of the > Product > > > entity and use a key only query to retrieve only the keys for the > search > > > index entities (since we only really care about the Products anyway). > > > > Good idea! > > > > > > > > > > > > > This will still to the same number of queries but will avoid the > overhead > > > of deserializing the ProductSearchIndex objects (and the associated > index > > > list property which might be long). > > > > > Something like the following should work: > > > > > class Product(db.Model): > > >pid = db.StringProperty(required=True) > > >title = db.StringProperty(required=True) > > >site = db.StringProperty(required=True) > > >url = db.LinkProperty(required=True) > > > > > class ProductSearchIndex(search.SearchableModel): > > ># parent == Product > > >title = db.StringProperty(required=True) > > > > > ... > > > # where you write the Product > > > product = Product(pid = pid, title=title, site=site, url=url) > > > product.put() > > > index = ProductSearchIndex(parent=product, title=title) > > > index.put() > > > > > ... > > > # where you search > > > keys = ProductSearchIndex.all(keys_only=True).search(query).fetch(100) > > > for key in keys: > > > product = Product.get(key.parent()) > > > print product.url > > > > This can be done much more efficiently: > > keys = ProductSearchIndex.all(keys_only=True).search(query).fetch(100) > > products = db.get(x.parent() for x in keys) > > > > Now you're down to just two round-trips! > > > > -Nick Johnson > > > > > > > > > > > > > On Tue, Jun 23, 2009 at 5:59 PM, ogterran > wrote: > > > > >> Hi Ian, > > > > >> Thanks for the response. > > >> I have one question on number of datastore calls. > > >> How many datastore calls is the query below making? > > >> Is it 1 or 100? > > > > >> > class Product(db.Model): > > >> >pid = db.StringProperty(required=True) > > >> >title = db.StringProperty(required=True) > > >> >site = db.StringProperty(required=True) > > >> >url = db.LinkProperty(required=True) > > > > >> > class ProductSearchIndex(search.SearchableModel): > > >> >product = db.ReferenceProperty(Product) > > >> >title = db.StringProperty(required=True) > > > > >> query = ProductSearchIndex.all().search(searchtext) > > >> results = query.fetch(100) > > >> for i, v in enumerate(results): > > >>print v.product.url > > > > >> Thanks > > >> Jon > > > > > -- > > > === > > > 株式会社ビープラウド イアン・ルイス > > > 〒150-0012 > > > 東京都渋谷区広尾1-11-2アイオス広尾ビル604 > > > email: ianmle...@beproud.jp > > > TEL:03-5795-2707 > > > FAX:03-5795-2708 > > >http://www.beproud.jp/ > > > === > > > > -- > > Nick Johnson, App Engine Developer Programs Engineer > > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration > Number: > > 368047 > > > -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
Argh, I didn't test it to make sure it actually worked. Is there a bug I can star for this issue? 2009/6/23 Nick Johnson (Google) > You're quite right. This will be fixed in a future release. > > -Nick Johnson > > 2009/6/23 acuth > > >> Whenever I've tried doing a SearchableModelDescendant.all >> (keys_only=True).search(query) construction, it has failed saying it >> doesn't understand the keys_only parameter - see 'Using __key__ and >> SearchableModel >> http://groups.google.com/group/google-appengine/browse_thread/thread/73dc1dc31bfd497b >> >> Do you know if this was fixed in a recent release? >> >> Adrian >> >> >> On Jun 23, 11:33 am, "Nick Johnson (Google)" >> wrote: >> > 2009/6/23 Ian Lewis >> > >> > > ogterran, >> > >> > > It should do one for the search and then one for each item in the >> search >> > > result. >> > >> > Not quite - it will do one _query_, and multiple gets. A get is much, >> much >> > cheaper than a query. You're right about the number of round-trips, >> though. >> > >> > > If you are worried performance on the calls to the datastore you can >> modify >> > > this code to make the ProductSearchIndex entity be a child of the >> Product >> > > entity and use a key only query to retrieve only the keys for the >> search >> > > index entities (since we only really care about the Products anyway). >> > >> > Good idea! >> > >> > >> > >> > >> > >> > > This will still to the same number of queries but will avoid the >> overhead >> > > of deserializing the ProductSearchIndex objects (and the associated >> index >> > > list property which might be long). >> > >> > > Something like the following should work: >> > >> > > class Product(db.Model): >> > >pid = db.StringProperty(required=True) >> > >title = db.StringProperty(required=True) >> > >site = db.StringProperty(required=True) >> > >url = db.LinkProperty(required=True) >> > >> > > class ProductSearchIndex(search.SearchableModel): >> > ># parent == Product >> > >title = db.StringProperty(required=True) >> > >> > > ... >> > > # where you write the Product >> > > product = Product(pid = pid, title=title, site=site, url=url) >> > > product.put() >> > > index = ProductSearchIndex(parent=product, title=title) >> > > index.put() >> > >> > > ... >> > > # where you search >> > > keys = ProductSearchIndex.all(keys_only=True).search(query).fetch(100) >> > > for key in keys: >> > > product = Product.get(key.parent()) >> > > print product.url >> > >> > This can be done much more efficiently: >> > keys = ProductSearchIndex.all(keys_only=True).search(query).fetch(100) >> > products = db.get(x.parent() for x in keys) >> > >> > Now you're down to just two round-trips! >> > >> > -Nick Johnson >> > >> > >> > >> > >> > >> > > On Tue, Jun 23, 2009 at 5:59 PM, ogterran >> wrote: >> > >> > >> Hi Ian, >> > >> > >> Thanks for the response. >> > >> I have one question on number of datastore calls. >> > >> How many datastore calls is the query below making? >> > >> Is it 1 or 100? >> > >> > >> > class Product(db.Model): >> > >> >pid = db.StringProperty(required=True) >> > >> >title = db.StringProperty(required=True) >> > >> >site = db.StringProperty(required=True) >> > >> >url = db.LinkProperty(required=True) >> > >> > >> > class ProductSearchIndex(search.SearchableModel): >> > >> >product = db.ReferenceProperty(Product) >> > >> >title = db.StringProperty(required=True) >> > >> > >> query = ProductSearchIndex.all().search(searchtext) >> > >> results = query.fetch(100) >> > >> for i, v in enumerate(results): >> > >>print v.product.url >> > >> > >> Thanks >> > >> Jon >> > >> > > -- >> > > === >> > > 株式会社ビープラウド イアン・ルイス >> > > 〒150-0012 >> > > 東京都渋谷区広尾1-11-2アイオス広尾ビル604 >> > > email: ianmle...@beproud.jp >> > > TEL:03-5795-2707 >> > > FAX:03-5795-2708 >> > >http://www.beproud.jp/ >> > > === >> > >> > -- >> > Nick Johnson, App Engine Developer Programs Engineer >> > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration >> Number: >> > 368047 >> >> > > > -- > Nick Johnson, App Engine Developer Programs Engineer > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: > 368047 > > > > -- === 株式会社ビープラウド イアン・ルイス 〒150-0012 東京都渋谷区広尾1-11-2アイオス広尾ビル604 email: ianmle...@beproud.jp TEL:03-5795-2707 FAX:03-5795-2708 http://www.beproud.jp/ === --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~--
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
Thanks for all the responses. I'll use Ian's first suggestion on Product, ProductIndex until key_only query issue is resolved. How do I change my bulkloader to update the Product and ProductIndex on one upload? class ProductLoader(bulkloader.Loader): def __init__(self): bulkloader.Loader.__init__(self, 'Product', [('pid', str), ('title', lambda x: unicode(x, 'utf-8')), ('site', str), ('url', str) ]) Thanks Jon --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
Hi ogterran, You'll need to define a custom handle_entity function for your loader class. This function can return multiple ProductIndex entities in addition to the Product entity being loaded. See the docstring for details: http://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/tools/bulkloader.py#3243 -Nick Johnson On Wed, Jun 24, 2009 at 10:09 AM, ogterran wrote: > > Thanks for all the responses. > I'll use Ian's first suggestion on Product, ProductIndex until > key_only query issue is resolved. > > How do I change my bulkloader to update the Product and ProductIndex > on one upload? > > class ProductLoader(bulkloader.Loader): >def __init__(self): >bulkloader.Loader.__init__(self, 'Product', > [('pid', str), >('title', lambda x: unicode(x, > 'utf-8')), >('site', str), >('url', str) > ]) > > Thanks > Jon > > > -- Nick Johnson, App Engine Developer Programs Engineer Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: 368047 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
Worked great Nick. Thanks for all your help On Jun 24, 3:27 am, "Nick Johnson (Google)" wrote: > Hi ogterran, > > You'll need to define a custom handle_entity function for your loader class. > This function can return multiple ProductIndex entities in addition to the > Product entity being loaded. See the docstring for > details:http://code.google.com/p/googleappengine/source/browse/trunk/python/g... > > -Nick Johnson > > > > > > On Wed, Jun 24, 2009 at 10:09 AM, ogterran wrote: > > > Thanks for all the responses. > > I'll use Ian's first suggestion on Product, ProductIndex until > > key_only query issue is resolved. > > > How do I change my bulkloader to update the Product and ProductIndex > > on one upload? > > > class ProductLoader(bulkloader.Loader): > > def __init__(self): > > bulkloader.Loader.__init__(self, 'Product', > > [('pid', str), > > ('title', lambda x: unicode(x, > > 'utf-8')), > > ('site', str), > > ('url', str) > > ]) > > > Thanks > > Jon > > -- > Nick Johnson, App Engine Developer Programs Engineer > Google Ireland Ltd. :: Registered in Dublin, Ireland, Registration Number: > 368047 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---
[google-appengine] Re: How do I limit searchable_text_index using SearchableModel?
On 10 Jun., 11:11, ogterran wrote: > Hi, > > When I create a datastore model using SearchableModel, it creates a > __searchable_text_index column, for full textsearch. > If I don't want all the columns to be part of the index forsearch, > how do I exclude columns for full textsearch? > > i.e. > I don't want pid, site, and url to be part of the full textsearch. > > class Product(search.SearchableModel): > pid = db.StringProperty(required=True) > title = db.StringProperty(required=True) > site = db.StringProperty(required=True) > url = db.LinkProperty(required=True) > > Thanks > Jon Hi, you can try to use with gae-search. It allows for indexing only specific properties. Visit http://gae-full-text-search.appspot.com/ and take a look at the documentation/demos. I hope you will like it. Best regards Thomas --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to google-appengine+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~--~~~~--~~--~--~---