elasticsearch-analysis-mmseg icon indicating copy to clipboard operation
elasticsearch-analysis-mmseg copied to clipboard

QueryShardException: failed to create query

Open LoveEachDay opened this issue 7 years ago • 2 comments

Recently I've upgrade ES from 2.1.0 to ES 5.2.2, which also using the analysis-mmseg plugin. I've followed the procedure to rebuild the plugin, change the index setting. And after restart ES, everything seems ok. Here's the index mapping:

{
  "users" : {
    "mappings" : {
      "user" : {
        "dynamic" : "false",
        "properties" : {
          "analyzed_name" : {
            "type" : "text",
            "analyzer" : "mmseg_maxword"
          },
          "id" : {
            "type" : "integer"
          },
          "likes_count" : {
            "type" : "integer"
          },
          "nickname" : {
            "type" : "keyword",
            "copy_to" : [
              "analyzed_name"
            ]
          }
        }
      }
    }
  }
}

When I make a simple query, the output become randomly:

curl 'localhost:9200/users/_search?pretty'  -d '{
  "query": {
    "bool": {
      "should": [
        {
          "match_phrase": {
            "nickname": {
              "query": "十分",
              "boost": 100
            }
          }
        },
        {
          "match_phrase": {
            "analyzed_name": {
              "query": "十分",
              "boost": 50,
              "slop": 10
            }
          }
        },
        {
          "prefix": {
            "analyzed_name": "十分"
          }
        },
        {
          "match": {
            "analyzed_name": "十分"
          }
        }
      ],
      "minimum_should_match": 1
    }
  }
}'

Expected Output:

{
  "took": 3,
  "timed_out": false,
  "_shards": {
    "total": 35,
    "successful": 35,
    "failed": 0
  },
  "hits": {
    "total": 166,
    "max_score": 2012.748,
    "hits": [
      {
        "_index": "users",
        "_type": "user",
        "_id": "1210186",
        "_score": 2012.748,
        "_source": {
          "nickname": "十分",
          "likes_count": 1
        }
      },
      {
        "_index": "users",
        "_type": "user",
        "_id": "2466113",
        "_score": 734.9008,
        "_source": {
          "nickname": "十分十分",
          "likes_count": 1
        }
      },
      {
        "_index": "users",
        "_type": "user",
        "_id": "2493231",
        "_score": 626.3631,
        "_source": {
          "nickname": "十分十分er",
          "likes_count": 1
        }
      },
      {
        "_index": "users",
        "_type": "user",
        "_id": "47203",
        "_score": 533.75287,
        "_source": {
          "nickname": "十分tenmin",
          "likes_count": 1
        }
      },
      {
        "_index": "users",
        "_type": "user",
        "_id": "530063",
        "_score": 533.75287,
        "_source": {
          "nickname": "落日十分",
          "likes_count": 1
        }
      },
      {
        "_index": "users",
        "_type": "user",
        "_id": "3305185",
        "_score": 533.75287,
        "_source": {
          "nickname": "九点十分",
          "likes_count": 1
        }
      },
      {
        "_index": "users",
        "_type": "user",
        "_id": "3334990",
        "_score": 533.75287,
        "_source": {
          "nickname": "日出十分",
          "likes_count": 1
        }
      },
      {
        "_index": "users",
        "_type": "user",
        "_id": "4382556",
        "_score": 533.75287,
        "_source": {
          "nickname": "十分好奇",
          "likes_count": 1
        }
      },
      {
        "_index": "users",
        "_type": "user",
        "_id": "4441797",
        "_score": 533.75287,
        "_source": {
          "nickname": "黎明十分",
          "likes_count": 1
        }
      },
      {
        "_index": "users",
        "_type": "user",
        "_id": "2615409",
        "_score": 527.52295,
        "_source": {
          "nickname": "林十分",
          "likes_count": 1
        }
      }
    ]
  }
}

Actually result:

{
  "error" : {
    "root_cause" : [
      {
        "type" : "query_shard_exception",
        "reason" : "failed to create query: {\n  \"bool\" : {\n    \"should\" : [\n      {\n        \"match_phrase\" : {\n          \"nickname\" : {\n            \"query\" : \"十分\",\n            \"slop\" : 0,\n            \"boost\" : 100.0\n          }\n        }\n      },\n      {\n        \"match_phrase\" : {\n          \"analyzed_name\" : {\n            \"query\" : \"十分\",\n            \"slop\" : 10,\n            \"boost\" : 50.0\n          }\n        }\n      },\n      {\n        \"prefix\" : {\n          \"analyzed_name\" : {\n            \"value\" : \"十分\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"match\" : {\n          \"analyzed_name\" : {\n            \"query\" : \"十分\",\n            \"operator\" : \"OR\",\n            \"prefix_length\" : 0,\n            \"max_expansions\" : 50,\n            \"fuzzy_transpositions\" : true,\n            \"lenient\" : false,\n            \"zero_terms_query\" : \"NONE\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"disable_coord\" : false,\n    \"adjust_pure_negative\" : true,\n    \"minimum_should_match\" : \"1\",\n    \"boost\" : 1.0\n  }\n}",
        "index_uuid" : "G5kCglksQQmnc21W7nJnAw",
        "index" : "users"
      }
    ],
    "type" : "search_phase_execution_exception",
    "reason" : "all shards failed",
    "phase" : "query",
    "grouped" : true,
    "failed_shards" : [
      {
        "shard" : 0,
        "index" : "users",
        "node" : "HDqZAuQORYeeLHmmhsEMTQ",
        "reason" : {
          "type" : "query_shard_exception",
          "reason" : "failed to create query: {\n  \"bool\" : {\n    \"should\" : [\n      {\n        \"match_phrase\" : {\n          \"nickname\" : {\n            \"query\" : \"十分\",\n            \"slop\" : 0,\n            \"boost\" : 100.0\n          }\n        }\n      },\n      {\n        \"match_phrase\" : {\n          \"analyzed_name\" : {\n            \"query\" : \"十分\",\n            \"slop\" : 10,\n            \"boost\" : 50.0\n          }\n        }\n      },\n      {\n        \"prefix\" : {\n          \"analyzed_name\" : {\n            \"value\" : \"十分\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"match\" : {\n          \"analyzed_name\" : {\n            \"query\" : \"十分\",\n            \"operator\" : \"OR\",\n            \"prefix_length\" : 0,\n            \"max_expansions\" : 50,\n            \"fuzzy_transpositions\" : true,\n            \"lenient\" : false,\n            \"zero_terms_query\" : \"NONE\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"disable_coord\" : false,\n    \"adjust_pure_negative\" : true,\n    \"minimum_should_match\" : \"1\",\n    \"boost\" : 1.0\n  }\n}",
          "index_uuid" : "G5kCglksQQmnc21W7nJnAw",
          "index" : "users",
          "caused_by" : {
            "type" : "null_pointer_exception",
            "reason" : null
          }
        }
      }
    ],
    "caused_by" : {
      "type" : "query_shard_exception",
      "reason" : "failed to create query: {\n  \"bool\" : {\n    \"should\" : [\n      {\n        \"match_phrase\" : {\n          \"nickname\" : {\n            \"query\" : \"十分\",\n            \"slop\" : 0,\n            \"boost\" : 100.0\n          }\n        }\n      },\n      {\n        \"match_phrase\" : {\n          \"analyzed_name\" : {\n            \"query\" : \"十分\",\n            \"slop\" : 10,\n            \"boost\" : 50.0\n          }\n        }\n      },\n      {\n        \"prefix\" : {\n          \"analyzed_name\" : {\n            \"value\" : \"十分\",\n            \"boost\" : 1.0\n          }\n        }\n      },\n      {\n        \"match\" : {\n          \"analyzed_name\" : {\n            \"query\" : \"十分\",\n            \"operator\" : \"OR\",\n            \"prefix_length\" : 0,\n            \"max_expansions\" : 50,\n            \"fuzzy_transpositions\" : true,\n            \"lenient\" : false,\n            \"zero_terms_query\" : \"NONE\",\n            \"boost\" : 1.0\n          }\n        }\n      }\n    ],\n    \"disable_coord\" : false,\n    \"adjust_pure_negative\" : true,\n    \"minimum_should_match\" : \"1\",\n    \"boost\" : 1.0\n  }\n}",
      "index_uuid" : "G5kCglksQQmnc21W7nJnAw",
      "index" : "users",
      "caused_by" : {
        "type" : "null_pointer_exception",
        "reason" : null
      }
    }
  },
  "status" : 400
}

The Elasticsearch Log:

Caused by: org.elasticsearch.index.query.QueryShardException: failed to create query: {
  "bool" : {
    "should" : [
      {
        "match_phrase" : {
          "nickname" : {
            "query" : "十分",
            "slop" : 0,
            "boost" : 100.0
          }
        }
      },
      {
        "match_phrase" : {
          "analyzed_name" : {
            "query" : "十分",
            "slop" : 10,
            "boost" : 50.0
          }
        }
      },
      {
        "prefix" : {
          "nickname" : {
            "value" : "十分",
            "boost" : 1.0
          }
        }
      },
      {
        "match" : {
          "analyzed_name" : {
            "query" : "十分",
            "operator" : "OR",
            "prefix_length" : 0,
            "max_expansions" : 50,
            "fuzzy_transpositions" : true,
            "lenient" : false,
            "zero_terms_query" : "NONE",
            "boost" : 1.0
          }
        }
      }
    ],
    "disable_coord" : false,
    "adjust_pure_negative" : true,
    "minimum_should_match" : "1",
    "boost" : 1.0
  }
}
	at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:333) ~[elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.index.query.QueryShardContext.toQuery(QueryShardContext.java:311) ~[elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.search.SearchService.parseSource(SearchService.java:671) ~[elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.search.SearchService.createContext(SearchService.java:540) ~[elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.search.SearchService.createAndPutContext(SearchService.java:516) ~[elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.search.SearchService.executeQueryPhase(SearchService.java:251) ~[elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:298) ~[elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.action.search.SearchTransportService$6.messageReceived(SearchTransportService.java:295) ~[elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.transport.TransportService$7.doRun(TransportService.java:610) [elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:596) [elasticsearch-5.2.2.jar:5.2.2]
	at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.2.2.jar:5.2.2]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_111]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_111]
	at java.lang.Thread.run(Thread.java:745) [?:1.8.0_111]
Caused by: java.lang.NullPointerException
	at com.chenlb.mmseg4j.rule.MaxMatchRule.isRemove(MaxMatchRule.java:28) ~[?:?]
	at com.chenlb.mmseg4j.rule.Rule.remainChunks(Rule.java:40) ~[?:?]
	at com.chenlb.mmseg4j.ComplexSeg.seg(ComplexSeg.java:96) ~[?:?]
	at com.chenlb.mmseg4j.MaxWordSeg.seg(MaxWordSeg.java:19) ~[?:?]
	at com.chenlb.mmseg4j.MMSeg.next(MMSeg.java:178) ~[?:?]
	at com.chenlb.mmseg4j.analysis.MMSegTokenizer.incrementToken(MMSegTokenizer.java:64) ~[?:?]
	at org.apache.lucene.analysis.LowerCaseFilter.incrementToken(LowerCaseFilter.java:44) ~[lucene-core-6.4.1.jar:6.4.1 72f75b2503fa0aa4f0aff76d439874feb923bb0e - jpountz - 2017-02-01 14:43:32]

Any help is appreciated.

LoveEachDay avatar Mar 23 '17 11:03 LoveEachDay

can you try this: https://github.com/medcl/elasticsearch-analysis-mmseg/releases/tag/v5.2.2

medcl avatar Mar 27 '17 14:03 medcl

I've tried the version, the query shard exception has gone.

While I make another query with highlighting, the returned result which matches the query has no 'highlight'.

The index setting:

{
  "notes" : {
    "settings" : {
      "index" : {
        "number_of_shards" : "5",
        "provided_name" : "notes",
        "creation_date" : "1490674236054",
        "analysis" : {
          "filter" : {
            "chineseStopwordsFilter" : {
              "type" : "stop",
              "stopwords_path" : "stopwords/chinese.txt"
            }
          },
          "analyzer" : {
            "mmseg_maxword_with_stop" : {
              "filter" : [
                "lowercase",
                "chineseStopwordsFilter"
              ],
              "type" : "custom",
              "tokenizer" : "mmseg_maxword"
            },
            "mmseg_maxword" : {
              "filter" : "lowercase",
              "type" : "custom",
              "tokenizer" : "mmseg_maxword"
            },
            "mmseg_maxword_with_cut_letter_digi" : {
              "filter" : [
                "lowercase",
                "cut_letter_digit"
              ],
              "type" : "custom",
              "tokenizer" : "mmseg_maxword"
            }
          }
        },
        "number_of_replicas" : "1",
        "uuid" : "7bbS0QHOQPyzNpd3NwDTfw",
        "version" : {
          "created" : "5020299"
        }
      }
    }
  }
}

The Index mapping:

{
  "notes" : {
    "mappings" : {
      "note" : {
        "dynamic" : "false",
        "properties" : {
          "author_id" : {
            "type" : "integer"
          },
          "author_name" : {
            "type" : "text",
            "analyzer" : "mmseg_maxword"
          },
          "comment_updated_at" : {
            "type" : "integer",
            "copy_to" : [
              "commented_at"
            ]
          },
          "commented_at" : {
            "type" : "integer"
          },
          "first_shared_at" : {
            "type" : "date",
            "copy_to" : [
              "published_at"
            ]
          },
          "id" : {
            "type" : "integer"
          },
          "likes_count" : {
            "type" : "integer",
            "copy_to" : [
              "top"
            ]
          },
          "locked" : {
            "type" : "boolean"
          },
          "public_comments_count" : {
            "type" : "integer"
          },
          "public_stripped_content" : {
            "type" : "text",
            "norms" : false,
            "analyzer" : "mmseg_maxword"
          },
          "public_title" : {
            "type" : "text",
            "norms" : false,
            "analyzer" : "mmseg_maxword"
          },
          "published_at" : {
            "type" : "date"
          },
          "shared" : {
            "type" : "boolean"
          },
          "top" : {
            "type" : "integer"
          }
        }
      }
    }
  }
}

The query with highlighting:

{
  "query": {
    "bool": {
      "should": [
        {
          "match_phrase": {
            "public_title": {
              "query": "十分",
              "analyzer": "mmseg_maxword",
              "slop": 10,
              "boost": 50
            }
          }
        },
        {
          "match": {
            "public_title": {
              "query": "十分",
              "boost": 20
            }
          }
        },
        {
          "match_phrase": {
            "public_stripped_content": {
              "query": "十分",
              "analyzer": "mmseg_maxword_with_stop",
              "boost": 30
            }
          }
        },
        {
          "match": {
            "public_stripped_content": {
              "query": "十分",
              "analyzer": "mmseg_maxword_with_stop",
              "boost": 10
            }
          }
        },
        {
          "match": {
            "author_name": {
              "query": "十分",
              "analyzer": "mmseg_maxword_with_stop",
              "boost": 1
            }
          }
        }
      ],
      "minimum_should_match": 2,
      "filter": {
        "bool": {
          "must": [
            {
              "term": {
                "shared": true
              }
            },
            {
              "term": {
                "locked": false
              }
            }
          ]
        }
      }
    }
  },
  "highlight": {
    "pre_tags": [
      "<em class='search-result-highlight'>"
    ],
    "post_tags": [
      "</em>"
    ],
    "fields": {
      "public_title": {
        "number_of_fragments": 1
      },
      "public_stripped_content": {
        "fragment_size": 100,
        "number_of_fragments": 3
      },
      "author_name": {
        "number_of_fragments": 1
      }
    }
  }
}

The return result:

"hits": [
	{
		"_index": "notes",
		"_type": "note",
		"_id": "108687",
		"_score": 266.63876,
		"_source": {
			"id": 108687,
			"created_at": "2014-03-07T20:03:13.000+08:00",
			"updated_at": "2016-07-19T03:36:01.000+08:00",
			"notebook_id": 55724,
			"shared": true,
			"slug": "6f6e00098a8e",
			"shared_at": "2014-03-07T20:35:42.000+08:00",
			"seq_in_nb": 16,
			"note_type": "plain",
			"locked": false,
			"locked_at": null,
			"likes_count": 0,
			"image_file_name": "image_5d60ebe96aad.jpeg",
			"generating_image": 0,
			"image_generated_at": 1407268801,
			"commentable": true,
			"last_stopped_share_at": "2014-03-07T20:35:42.000+08:00",
			"bookmarks_count": 0,
			"last_compiled_at": 1407268801,
			"first_shared_at": "2014-03-07T20:35:42.000+08:00",
			"title_image": null,
			"deleted_at": null,
			"comment_updated_at": 0,
			"user_id": 29533,
			"public_title": "驾考小结7",
			"public_stripped_content": "通过三次的努力,小五项可算是过了,静静地等待着下一科目的考试。此时,工作一天比一天繁忙起来,只好全身心的投入工作,本来工作还好好的,可是有几件事情,弄得现在十分的狼狈,在这个地方呆着,仿佛就是一场灾难,各中原因,届时将会在苏宁篇中详细记述,此处不表。 日子一天天地晃悠着,每天还是两点一线的生活,家—单位—家,时光就这样日复一日地周而复始着,很想改变些什么,但心中的那种恐惧,不知如何去消除,然后下定决心去打破那个旧有的世界。为了解除这种痛苦的生活,又开始在投递简历,寻找新的环境,以求换个新的生活,迎接新的挑战,开始一段新的旅程。 大约在十月下旬的时候,教练通知,练习路上驾驶,那天去的不算早也不算晚,要早八点半到,去单位打了个卡,九点半就到训练的地方了。稍稍等了片刻,就上了车,开始了科目三的一切,上车,系安全带,踩离合,挂一档,松离合,打转向灯,踩油门,加档位,再也不像科目二那般永远的一档了,练了两小时,开了三段路,感觉十分的不好,中途熄火,停车后,没有回空档,高速档起步,反正这段路上出现了各种状况,教练又发话了,对着一车的人,当时确实有些挂不住面子,毕竟都是成年人,说,你学车怎怎总比别人慢半拍,上路就这么点东西,你今天也开得十分的糟糕。我无言以对,只能苦笑了下,可能笨了一点,感觉就是手脚配合跟不上。后,给了我们一些关于夜考灯光的考试大纲,让我们回到家里记牢,当天就散了。让后两天都去练车。 之后的两天,原本打算去练路上驾驭的,第一天,接到一个面试通过,到了金山桥,回来天都快放黑了,只好作罢,第二天,让去新区快到贾汪的面试,当回到市区时,都是下班时间了,也没有时间练习了。第三天就要考试了,教练见我基本没练,也没有给我报告,我也知道自己当时的状况与水平,去考试,能通过,那一定是运气,过不了,那一定再正常不过了。所以,我没教练打电话,说这次非考不可,既然没报名,那就下次吧。 谁知这一等,就到年后了,年前也给教练打破常规了几次电话,询问考试的事儿,答,前些天刚考结束,没让我们补考的报名,晕,我没考过啊,怎么算补考的呢。都这样子了,还能如何,只好继续等待。忙着过年,年前又换了个工作,心情状况都不是十分理想,就得过且过了,这个事也没过问。 那天,又打电话问,教练什么时候可以练习然后考试,三月一号考试,二月二十八号去练一天,我知道自己当时是什么水平,也十分清楚那个时候对车的感觉。依然感觉,车又变得如此陌生了,坐在驾驭员的位置上会很紧张。练一天一定通过不了的,于是乎就自掏腰包,找陪练练习下。 二十六号,去考试现场,找到当时唯一的一位教练,简单询问了下价钱,没还价就直接上车练习了,我告诉他说,之前相当没碰过车,他说,没关系,一步步来,首先,他把灯光考试的内容给我讲了一遍,有了点记忆,不深,接着,就正式练习,按着之前文章中的步奏来,一开始还是不好,时间过得飞快,开了两圈,一小时就到了。二十七号,依旧找这位教练,又是一小时,明显感觉不一样,对车有了一种控制感了,教练也说,比第一天好多了。二十八号,跟着教校的车练,教练没再说什么,只说了句,这次开得还不错。 就等着三月一号到来,等着路考了。",
			"public_comments_count": 0,
			"author_name": "秋若静美",
			"author_id": 29533
		}
	},
	{
		"_index": "notes",
		"_type": "note",
		"_id": "40847",
		"_score": 255.85864,
		"_source": {
			"id": 40847,
			"created_at": "2013-07-27T09:27:15.000+08:00",
			"updated_at": "2016-07-19T03:31:37.000+08:00",
			"notebook_id": 19983,
			"shared": true,
			"slug": "asFSzL",
			"shared_at": "2013-07-28T10:21:01.000+08:00",
			"seq_in_nb": 81,
			"note_type": "plain",
			"locked": false,
			"locked_at": null,
			"likes_count": 10,
			"image_file_name": "image_b61175cd894d.jpeg",
			"generating_image": 0,
			"image_generated_at": 1407268359,
			"commentable": true,
			"last_stopped_share_at": "2013-07-28T10:21:01.000+08:00",
			"bookmarks_count": 0,
			"last_compiled_at": 1407268359,
			"first_shared_at": "2013-07-28T10:21:01.000+08:00",
			"title_image": null,
			"deleted_at": null,
			"comment_updated_at": 0,
			"user_id": 10481,
			"public_title": "写写.3",
			"public_stripped_content": "市面上关于写东西的书不少,随便一搜都一大把。一些作家曾经列出自己的写作原则,有些杂志也提出过些建议。虽然这些建议肯定不适合所有人,但是其中最重要的原则通用性很强:开始写。 可就是这条原则,也不容易做到。爱好者常常会因为各种原因而无法下笔:没想好开头、没有情节、不知道写什么、觉得很别扭,等等等等。都正常。既然写作是种技能,那么和其他技能一样,在还没有一定掌握前必然会有些不适。这种时候,就该意志力发挥作用了。 当觉得没什么可写的时候,找十分钟时间。无论是晚睡或者早起或者午休时间,只要抽出十分钟就好。先关掉所有可能干扰你的信息源,做几次深呼吸,然后开始写。用纸笔、Word、记事本还是vim或者gedit都不重要,没什么想写的也不重要。十分钟里,只做一件事:把自己脑中此刻的想法记录下来。 除非是冥想大师,否则头脑中不会一个念头都没有。把它们写下来,别管语法错别字之类,只是不停地写就好。只要坚持这么做,很快就会发现思维会变得活跃起来,能想到的东西越来越多,多到手都跟不上。十分钟过后,就会发现还是能写出来不少东西的。就这么简单。 建议每天都做一次这个练习。目的并不是写出什么很有价值的东西,而是打破对于“写东西”这件事的固有印象。不必等到想好了再下笔,甚至可以在想法还很模糊时就开始写。初稿是什么样子不要紧,反正还需要大量修改。写的动作会带动思维,最终让手的速度和脑的速度同步起来不分彼此——这样看来,还是练一种更快的输入法比较好。 罗伯特·海因莱因提出了五条写作原则,其中第一条就是“You must write.”我觉得,第二条和第一条一样重要:You must finish what you write.无论如何,写完它。不管开了个什么头,不管起了个什么题目,绞尽脑汁硬着头皮往下写,直到完全写完为止。这可能是爱好者最常碰到的第二个问题——硬盘里存了一堆自己的作品,但是都只有个开头。 完不成的借口很多,但是在写作这件事上,完成远比完美重要。把一个想法发展成完整的文章并不容易,而这正是坚持写完的意义所在。这同样是一种练习,需要我们拷打自己的大脑,推着自己往前走,直到基本上逻辑清晰言之有物善始善终。这种练习没什么好方法,只能不断用意志力推动自己而已。不过幸好,只要过了“开始写”这一关,写完一篇文章看起来也就不那么可怕了。 然后开始写下一篇。再下一篇。然后回头修改第一篇。反复修改,直到觉得怎么改都和以前某个版本差不多为止。写东西就是这样反复打磨的过程。啊,这和海因莱因的教诲背道而驰,他说You must refrain from rewriting, except to editorial order.但是我们不是海因莱因啊。他老人家大笔如椽,经得起这种玩笑;大部分人写的东西如果不改几次,只能落个惨不忍睹。要想拿出来给别人看,还是先多改几次比较好。 好了,这个系列就到此为止。文中提出的观点、给出的建议都很简单,对有经验的作者恐怕没什么帮助;但是如果能让几个想写而还没开始写的爱好者敲起键盘,就算是达到目的了。 P.s. 想要靠看书来练习和掌握写作的话,可以看看斯蒂芬·金的《写作这回事》、人大出版社的“创意写作”书系、著名的《<华尔街日报>是如何讲故事的》,当然还有乔治·奥威尔的六原则和《经济学人》的写作原则——这些国内已经有了一个不错的译本,是由王烁翻译的《有效写作十三篇》。 P.s.s.但是,英文写作和中文写作还是有些不一样,因此不能生搬硬套。王小波的《我的师承》中谈到了什么文字是好的;《关于文体》中谈到了文体。余光中先生的《论的的不休》中则讲到了如何才能让白话文紧凑通顺。这几篇文章都值得一读。 P.s.s.s. 哦,只说了海因莱因五原则的前三条是吧。在国内,职业作家很难拿到能让自己体面生活的报酬,这和美国不大一样。海因莱因的剩下两条原则是对职业作家的建议,分别是 You must put the work on the market,以及You must keep the work on the market until it is sold.这位老大爷还真是爱开玩笑啊。",
			"public_comments_count": 0,
			"author_name": "叶猛犸",
			"author_id": 10481
		},
		"highlight": {
			"public_stripped_content": [
				"发挥作用了。 当觉得没什么可写的时候,找<em class='search-result-highlight'>十分</em>钟时间。无论是晚睡或者早起或者午休时间,只要抽出<em class='search-result-highlight'>十分</em>钟就好。先关掉所有可能干扰你的信息源,做几次深呼吸,然后开始写。用纸笔、Word、记事本还是vim或者",
				"gedit都不重要,没什么想写的也不重要。<em class='search-result-highlight'>十分</em>钟里,只做一件事:把自己脑中此刻的想法记录下来。 除非是冥想大师,否则头脑中不会一个念头都没有。把它们写下来,别管语法错别字之类,只是不停地写就好。只要坚持",
				"这么做,很快就会发现思维会变得活跃起来,能想到的东西越来越多,多到手都跟不上。<em class='search-result-highlight'>十分</em>钟过后,就会发现还是能写出来不少东西的。就这么简单。 建议每天都做一次这个练习。目的并不是写出什么很有价值的东西,而是"
			]
		}
	}
]

LoveEachDay avatar Mar 28 '17 07:03 LoveEachDay