使用apache solr搜索特定列的数据(Specific column's data search using apache solr)
我正在使用apache Solr搜索我的数据库.. !!
假设我已经从我的一个表中索引了3列.. !! ..我只是想要只返回包含我的查询词的那些列作为响应.. !! ..是可能的.. ??
例如 :
我有一个带列的桌车:问题,答案,类型.. !! 现在我进行查询,例如:
localhost:8983/solr/select?q=tomato&wt=json
现在一些在某些行中只有名称可能包含“番茄”这个词
所以,作为回报,我只想要名称(以及其他一些固定字段,如ID)..同样,如果答案包含这个单词,那么只应该返回答案..而不是其他列.. !!
我怎么能实现这个.. ??
am using apache Solr for searching my database..!!
Suppose i have indexed 3 columns from one of my table..!!..I just want that only those columns that contains my query term are returned in response..!!..is that possible..??
For example :
I have a table cars with columns : questions, answer, type ..!! Now i make a query , something like :
localhost:8983/solr/select?q=tomato&wt=json
Now some in some rows only name may contain the word "tomato"
So, In return, i want only name (along with some other fixed fields like ID) ..Similarly, If answer contains this word, then only answer should be returned..and not other columns..!!
How can i acheive this..??
原文:https://stackoverflow.com/questions/18784855
最满意答案
插入查询中根本没有提到
IRS VAT Prod_ Posting Group
栏。 这个列很可能NOT NULL
,并且没有默认值。The column
IRS VAT Prod_ Posting Group
is not mentioned at all in your insert query. It's likely that this column isNOT NULL
and has no default value.
相关问答
更多-
您应该使用表的定义和您正在使用的数据库来编辑您的问题。 但问题很明显。 PatientRecord表有一个名为id的列,声明为NOT NULL 。 这意味着不允许使用NULL值 - 您将看到错误。 通过不在insert显式设置值,该值将设置为默认值。 没有默认值,该值设置为NULL 。 通常,此类列具有默认值或声明为identity (或自动递增)。 我认为您应该修复表,以便NOT NULL列具有默认值。 或者,为id列添加适当的值。 为此,您需要在列列表中添加id ,然后在值列表中添加相应的值。 You ...
-
尝试这个: INSERT INTO Test3 SELECT COALESCE(ColumnID, ROW_NUMBER() OVER (PARTITION By ColumnID ORDER BY ColumnID) + MAX(ColumnID) OVER ()) FROM Test2 在这里演示 Try this: INSERT INTO Test3 SE ...
-
我假设id应该是一个递增的值。 你需要设置这个,否则如果你有一个不可空的列,没有默认值,如果你没有提供任何值就会出错。 要在SQL Server Management Studio中设置自动增量: 在Design打开你的桌子 选择您的列,然后转到Column Properties 在Indentity Specification ,set (Is Identity)=Yes , Indentity Increment=1 I'm assuming that id is supposed to be an i ...
-
无法将值NULL插入到使用Sql Select语句的列中(Cannot insert the value NULL into column where using Sql Select statement)[2023-10-05]
正如@ jamieD77所述,您在insert语句中缺少IsDeleted列。 该错误意味着该列被标记为“NOT NULL”,因此在创建新行时必须插入一个值。 因此,您需要自己从表中删除NULL约束或在列中插入值。 INSERT INTO [Migrated].[dbo].[Cities] (Name, ZipCode, IsDeleted) select DISTINCT a.City,a.ZipCode,0 from [Legacy].[dbo].[Ziplist] as a where ( ... -
什么是SQL Server语法,其中NULL在列名后面?(What SQL Server syntax is this where the NULL is behind the column name?)[2022-05-16]
NULL是值。 列名称是列的名称。 我会这样写: select distinct null as column1, . . .. as更清楚地表明名称被赋予了价值。 在SQL Server中,您还可以使用: select distinct column1 = null, . . . 我不喜欢这种简写(因为它不受其他数据库支持,它看起来太像变量赋值)。 然而,它在一些人中很受欢迎。 The NULL is the value. The column name is the name of the colu ... -
插入查询中根本没有提到IRS VAT Prod_ Posting Group栏。 这个列很可能NOT NULL ,并且没有默认值。 The column IRS VAT Prod_ Posting Group is not mentioned at all in your insert query. It's likely that this column is NOT NULL and has no default value.
-
LINQ - 如何将null DateTime插入数据库列?(LINQ - How to insert null DateTime into database column?)[2023-05-10]
确保DB中的列设置为允许NULL,并将实体属性“CreateDate”定义为“DateTime?CreateDate {get; set;}”。 然后,只需设置“CreateDate = null”。 Ensure that the column in the DB is set to allow NULL and your entity property, "CreateDate" is defined as "DateTime? CreateDate {get;set;}". Then, simply ... -
问题在于,在一步中,SQL尝试填充所有4列,但是您只为CreatedDate和ModifiedDate提供了2个值。 因为所有列都具有NOT NULL,所以SQL不能保留缺少值的列。 有两个解决方案: 将列CreatedDate和ModifiedDate更改为NULL,因此在过程中它们将为NULL,但是使用触发器将填充它。 CreatedDate和ModifiedDate可以保留为NOT NULL列,但是您必须创建DEFAULT约束,这将确保在过程中使用某些默认值填充列(或者在过程中手动填充一些任意值),然 ...
-
一个空字符串与NULL值不同。 NULL真的意味着不可用,不知道。 您可以添加CHECK约束来实现您在之后的功能: ALTER TABLE mytable ADD CONSTRAINT CHK_EmptyString CHECK ( myCol <> '') An empty string is something different from a NULL value. NULL really means not available, not known. You can add a CHECK co ...
-
SQL Server:仅显示条件连续列不为空的行(SQL Server: display only rows where conditional concatinated column is not null)[2023-04-08]
你说“逻辑顺序”,但逻辑上, SELECT 在 WHERE 之后执行。 你可以把它放在子查询中: SELECT * FROM ( SELECT DISTINCT CONVERT (varchar(24), [LWEmail].[ID]) AS LogBatch, STUFF((SELECT CAST(', ' + LWEmail2.Email AS VARCHAR(MAX)) FROM [LWEmail] AS LWEmail2 WHERE LWEma ...