I still need help with this if anyone can take a look.

On Jul 28, 7:58 am, Jason Sznol <[email protected]> wrote:
> The same query in the line of code above used in an external Lucene
> search tool returns results. This is why I cannot figure out what is
> wrong.
>
> -Jason
>
> On Jul 28, 4:07 am, Markus Zywitza <[email protected]> wrote:
>
> > IIRC, where 1=0 is a placeholder in NHibernate that or-ed with the
> > actual search criteria. This would mean that your lucene query has no
> > results.
>
> > -Markus
>
> > 2010/7/26 Jason Sznol <[email protected]>:
>
> > > Can anyone help me get the NHibernate.Search functionality working in
> > > my project. I have been scouring the internet for days looking for
> > > answers but I cannot seem to find out what the problem is with my
> > > code. I read through the using page on the castle website on how to
> > > setup search. I have my program creating the index but when I try to
> > > query it through NHibernate, it generates SQL that ends with the
> > > clause "Where 1=0" resulting in no entities being pulled from the DB.
>
> > > I am using this piece of code to query using NHibernate.Search:
>
> > > Part[] entities = Part.FindAll(new LuceneQueryExpression(new
> > > TermQuery(new Term("ID",@"OPL\-6BA*"))));
>
> > > I've tried actually creating a full text session but when I try to
> > > create a similar query, the query object throws a bunch of exceptions
> > > internally and results in no objects being found as well.
>
> > > I believe I have the web.config setup properly. Here is a log of what
> > > it is doing.
>
> > > 00:18:00 [7] DEBUG NHibernate.Impl.SessionFactoryObjectFactory -
> > > initializing class SessionFactoryObjectFactory
> > > 00:18:00 [7] DEBUG NHibernate.Impl.SessionFactoryObjectFactory -
> > > registered: 23509b5478d147bc9f98bf1fccbf8254(unnamed)
> > > 00:18:00 [7] INFO  NHibernate.Impl.SessionFactoryObjectFactory - no
> > > name configured
> > > 00:18:00 [7] DEBUG NHibernate.Impl.SessionFactoryImpl - Instantiated
> > > session factory
> > > 00:18:00 [7] DEBUG NHibernate.Impl.SessionFactoryImpl - Checking 0
> > > named HQL queries
> > > 00:18:00 [7] DEBUG NHibernate.Impl.SessionFactoryImpl - Checking 0
> > > named SQL queries
> > > 00:18:00 [7] DEBUG NHibernate.Impl.SessionImpl - [session-
> > > id=7a073d33-3d0c-4050-aa52-149a61be9ccf] opened session at timestamp:
> > > 634157002805, for session factory: [/23509b5478d147bc9f98bf1fccbf8254]
> > > 00:18:00 [7] DEBUG NHibernate.Transaction.AdoTransaction - Begin
> > > (Unspecified)
> > > 00:18:00 [7] DEBUG NHibernate.Connection.DriverConnectionProvider -
> > > Obtaining IDbConnection from Driver
> > > 00:18:00 [7] DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator
> > > - put criteria=id in () alias=this0_
> > > 00:18:00 [7] INFO  NHibernate.Search.Reader.SharedReaderProvider -
> > > Opening IndexReader for directoryProviders: 2
> > > 00:18:00 [7] INFO  NHibernate.Search.Reader.SharedReaderProvider -
> > > Opening IndexReader from lucene.net.store.fsdirect...@c:\Work\Opel
> > > \trunk\design\software\OpelWeb\Index\Part.0
> > > 00:18:00 [7] INFO  NHibernate.Search.Reader.SharedReaderProvider - No
> > > shared IndexReader, opening a new one: lucene.net.store.fsdirect...@c:
> > > \Work\Opel\trunk\design\software\OpelWeb\Index\Part.0
> > > 00:18:00 [7] INFO  NHibernate.Search.Reader.SharedReaderProvider -
> > > Semaphore: 1 for Lucene.Net.Index.MultiSegmentReader
> > > 00:18:00 [7] INFO  NHibernate.Search.Reader.SharedReaderProvider -
> > > Opening IndexReader from lucene.net.store.fsdirect...@c:\Work\Opel
> > > \trunk\design\software\OpelWeb\Index\Part.1
> > > 00:18:00 [7] INFO  NHibernate.Search.Reader.SharedReaderProvider - No
> > > shared IndexReader, opening a new one: lucene.net.store.fsdirect...@c:
> > > \Work\Opel\trunk\design\software\OpelWeb\Index\Part.1
> > > 00:18:00 [7] INFO  NHibernate.Search.Reader.SharedReaderProvider -
> > > Semaphore: 1 for Lucene.Net.Index.MultiSegmentReader
> > > 00:18:01 [7] DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator
> > > - getCriteria for path=RequestedBy crit=
> > > 00:18:01 [7] DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator
> > > - getCriteria for path=ApprovedBy crit=
> > > 00:18:01 [7] DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator
> > > - getCriteria for path=Manufacturer crit=
> > > 00:18:01 [7] DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator
> > > - getCriteria for path=PartCategory crit=
> > > 00:18:01 [7] DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator
> > > - getCriteria for path=PartCategory.Department crit=
> > > 00:18:01 [7] DEBUG NHibernate.Loader.Criteria.CriteriaQueryTranslator
> > > - getCriteria for path=M2MPart crit=
> > > 00:18:01 [7] DEBUG NHibernate.AdoNet.AbstractBatcher - Opened new
> > > IDbCommand, open IDbCommands: 1
> > > 00:18:01 [7] DEBUG NHibernate.AdoNet.AbstractBatcher - Building an
> > > IDbCommand object for the SqlString: SELECT this_.ID as ID7_6_,
> > > this_.DateRequested as DateRequ2_7_6_, this_.DateApproved as
> > > DateAppr3_7_6_, this_.Status as Status7_6_, this_.DateDeleted as
> > > DateDele5_7_6_, this_.RequestDescription as RequestD6_7_6_,
> > > this_.PartDescription as PartDesc7_7_6_, this_.RoHS as RoHS7_6_,
> > > this_.SpecialNotes as SpecialN9_7_6_, this_.ManufacturerPartNumber as
> > > Manufac10_7_6_, this_.requestedby as request11_7_6_, this_.approvedby
> > > as approvedby7_6_, this_.Manufacturer as Manufac13_7_6_,
> > > this_.PartCategory as PartCat14_7_6_, opeluser2_.id as id5_0_,
> > > opeluser2_.username as username5_0_, opeluser2_.email as email5_0_,
> > > opeluser2_.ktusername as ktusername5_0_, opeluser2_.ktpassword as
> > > ktpassword5_0_, opeluser3_.id as id5_1_, opeluser3_.username as
> > > username5_1_, opeluser3_.email as email5_1_, opeluser3_.ktusername as
> > > ktusername5_1_, opeluser3_.ktpassword as ktpassword5_1_,
> > > manufactur4_.ID as ID3_2_, manufactur4_.Name as Name3_2_,
> > > manufactur4_.Website as Website3_2_, partcatego5_.ID as ID2_3_,
> > > partcatego5_.CategoryID as CategoryID2_3_, partcatego5_.Name as
> > > Name2_3_, partcatego5_.NumberFormat as NumberFo4_2_3_,
> > > partcatego5_.Department as Department2_3_, department6_.ID as ID0_4_,
> > > department6_.Name as Name0_4_, made2manag7_.ID as ID4_5_,
> > > made2manag7_.PartNumber as PartNumber4_5_, made2manag7_.Revision as
> > > Revision4_5_, made2manag7_.Description as Descript4_4_5_,
> > > made2manag7_.ProductClass as ProductC5_4_5_, made2manag7_.GroupCode as
> > > GroupCode4_5_, made2manag7_.UnitsForInventory as UnitsFor7_4_5_,
> > > made2manag7_.UnitsForVendors as UnitsFor8_4_5_,
> > > made2manag7_.CostPerInventoryUnit as CostPerI9_4_5_,
> > > made2manag7_.Source as Source4_5_, made2manag7_.ABCCode as
> > > ABCCode4_5_, made2manag7_.LeadTime as LeadTime4_5_,
> > > made2manag7_.Location as Location4_5_, made2manag7_.Facility as
> > > Facility4_5_ FROM Parts this_ inner join OpelUsers opeluser2_ on
> > > this_.requestedby=opeluser2_.id left outer join OpelUsers opeluser3_
> > > on this_.approvedby=opeluser3_.id left outer join Manufacturers
> > > manufactur4_ on this_.Manufacturer=manufactur4_.ID left outer join
> > > PartCategories partcatego5_ on this_.PartCategory=partcatego5_.ID left
> > > outer join Departments department6_ on
> > > partcatego5_.Department=department6_.ID left outer join
> > > Made2ManagePart made2manag7_ on this_.ID=made2manag7_.ID WHERE 1=0
> > > 00:18:01 [7] INFO  NHibernate.Loader.Loader - SELECT this_.ID as
> > > ID7_6_, this_.DateRequested as DateRequ2_7_6_, this_.DateApproved as
> > > DateAppr3_7_6_, this_.Status as Status7_6_, this_.DateDeleted as
> > > DateDele5_7_6_, this_.RequestDescription as RequestD6_7_6_,
> > > this_.PartDescription as PartDesc7_7_6_, this_.RoHS as RoHS7_6_,
> > > this_.SpecialNotes as SpecialN9_7_6_, this_.ManufacturerPartNumber as
> > > Manufac10_7_6_, this_.requestedby as request11_7_6_, this_.approvedby
> > > as approvedby7_6_, this_.Manufacturer as Manufac13_7_6_,
> > > this_.PartCategory as PartCat14_7_6_, opeluser2_.id as id5_0_,
> > > opeluser2_.username as username5_0_, opeluser2_.email as email5_0_,
> > > opeluser2_.ktusername as ktusername5_0_, opeluser2_.ktpassword as
> > > ktpassword5_0_, opeluser3_.id as id5_1_, opeluser3_.username as
> > > username5_1_, opeluser3_.email as email5_1_, opeluser3_.ktusername as
> > > ktusername5_1_, opeluser3_.ktpassword as ktpassword5_1_,
> > > manufactur4_.ID as ID3_2_, manufactur4_.Name as Name3_2_,
> > > manufactur4_.Website as Website3_2_, partcatego5_.ID as ID2_3_,
> > > partcatego5_.CategoryID as CategoryID2_3_, partcatego5_.Name as
> > > Name2_3_, partcatego5_.NumberFormat as NumberFo4_2_3_,
> > > partcatego5_.Department as Department2_3_, department6_.ID as ID0_4_,
> > > department6_.Name as Name0_4_, made2manag7_.ID as ID4_5_,
> > > made2manag7_.PartNumber as PartNumber4_5_, made2manag7_.Revision as
> > > Revision4_5_, made2manag7_.Description as Descript4_4_5_,
> > > made2manag7_.ProductClass as ProductC5_4_5_, made2manag7_.GroupCode as
> > > GroupCode4_5_, made2manag7_.UnitsForInventory as UnitsFor7_4_5_,
> > > made2manag7_.UnitsForVendors as UnitsFor8_4_5_,
> > > made2manag7_.CostPerInventoryUnit as CostPerI9_4_5_,
> > > made2manag7_.Source as Source4_5_, made2manag7_.ABCCode as
> > > ABCCode4_5_, made2manag7_.LeadTime as LeadTime4_5_,
> > > made2manag7_.Location as Location4_5_, made2manag7_.Facility as
> > > Facility4_5_ FROM Parts this_ inner join OpelUsers opeluser2_ on
> > > this_.requestedby=opeluser2_.id left outer join OpelUsers opeluser3_
> > > on this_.approvedby=opeluser3_.id left outer join Manufacturers
> > > manufactur4_ on this_.Manufacturer=manufactur4_.ID left outer join
> > > PartCategories partcatego5_ on this_.PartCategory=partcatego5_.ID left
> > > outer join Departments department6_ on
> > > partcatego5_.Department=department6_.ID left outer join
> > > Made2ManagePart made2manag7_ on this_.ID=made2manag7_.ID WHERE 1=0
> > > 00:18:01 [7] DEBUG NHibernate.SQL - SELECT this_.ID as ID7_6_,
> > > this_.DateRequested as DateRequ2_7_6_, this_.DateApproved as
> > > DateAppr3_7_6_, this_.Status as Status7_6_, this_.DateDeleted as
> > > DateDele5_7_6_, this_.RequestDescription as RequestD6_7_6_,
>
> ...
>
> read more »

-- 
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en.

Reply via email to