2

J'ai SQL Server 2005 Express Edition avec Advanced Services. J'ai permis FullText et créé un catalogue comme suit:La recherche Fulltext SQL Server ne donne aucun résultat

create FullText catalog MyDatabase_FT in path 'mypath' as default 

J'ai ensuite créé un index de texte intégral comme suit:

create FullText index on Cell (CellName) key index PK_Cell 
    with CHANGE_TRACKING AUTO 

J'ai exécuté les requêtes suivantes:

1) select count(*) from Cell where contains (CellName, 'CU*') 
2) select count(*) from Cell where CellName like 'CU%' 

et a obtenu les éléments suivants résultats:

1) 0
2) 24

Je me rends compte que cela peut prendre un certain temps pour remplir les index FullText. Cependant, malgré beaucoup de temps (12 heures), je n'obtiens toujours aucun résultat. J'étudié puis encore en utilisant la fonction OBJECTPROPERTYEX() et exécuté les éléments suivants:

declare @id int 
select @id = id FROM sys.sysobjects where [Name] = 'Cell' 
select 'TableFullTextBackgroundUpdateIndexOn' as 'Property', objectpropertyex(@id, 'TableFullTextBackgroundUpdateIndexOn') as 'Value' 
union select 'TableFullTextChangeTrackingOn', objectpropertyex(@id, 'TableFullTextChangeTrackingOn') 
union select 'TableFulltextDocsProcessed', objectpropertyex(@id, 'TableFulltextDocsProcessed') 
union select 'TableFulltextFailCount', objectpropertyex(@id, 'TableFulltextFailCount') 
union select 'TableFulltextItemCount', objectpropertyex(@id, 'TableFulltextItemCount') 
union select 'TableFulltextKeyColumn', objectpropertyex(@id, 'TableFulltextKeyColumn') 
union select 'TableFulltextPendingChanges', objectpropertyex(@id, 'TableFulltextPendingChanges') 
union select 'TableHasActiveFulltextIndex', objectpropertyex(@id, 'TableHasActiveFulltextIndex') 

Cela a donné les résultats suivants:

TableFullTextBackgroundUpdateIndexOn 1
TableFullTextChangeTrackingOn 1
TableFulltextDocsProcessed 11024
TableFulltextFailCount 0
TableFulltextItemCount 4038
TableFulltextKeyColumn 1
TableFulltextPendingChanges 0
TableHasActiveFulltextIndex 1

J'ai alors essayé de faire une nouvelle pleine population de l'indice comme suit:

alter fulltext index on Cell start full population 

Et je reçois l'avertissement suivant:

Warning: Request to start a full-text index population on table or indexed view 'Cell' is ignored because a population is currently active for this table or indexed view.

I essayé une mise à jour de la population comme suit:

alter fulltext index on Cell start update population 

Cela renvoyait: "Command (s) completed successfully.", Mais je n'obtiens toujours aucun résultat sur la recherche FullText.

Qu'est-ce qui me manque? Que dois-je faire pour que la recherche FullText fonctionne?

Merci, Elan

Répondre

4

Eh bien tout bouilli jusqu'à la mise en forme du texte de recherche.

C'était incorrect:

select count(*) from Cell where contains (CellName, 'CU*') 

C'était correct:

select count(*) from Cell where contains (CellName, '"CU*"') 

Tout fonctionne très bien!